life.i.think: Alias is Not Just a Campy TV Show

Alias is Not Just a Campy TV Show
Scribbled on October 19th. 1 comment.

Often in Ruby/Rails we want to override inherit class methods, like AR.find or AR.destroy (to find by another id type or not actually DROP the record but flag it as deleted via a boolean column, for example).

class Script < ActiveRecord::Base
  class << self
    alias :old_find :find
  end

  def self.find(*args)
    self.old_find(*args)
  end
end
Comments

Leave a response

  1. StelaaHotJune 08, 2007 @ 04:16 PM

    Find next sex partner HERE....... http://myfriendshere.tripod.com

Comment