Skip to content

Instantly share code, notes, and snippets.

@skamithi
Created April 20, 2009 12:13
Show Gist options
  • Save skamithi/98507 to your computer and use it in GitHub Desktop.
Save skamithi/98507 to your computer and use it in GitHub Desktop.
how to override a function in rails
How to override a function in rails from Yuhuda Katz. I'm new to ruby and this always confuses me. nice to have a good example from a guru.
class Foo < ActiveRecord::Base
include FooBar
end
module FooBar
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def find(*args)
super
#...or whatever
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment