Created
April 20, 2009 12:13
-
-
Save skamithi/98507 to your computer and use it in GitHub Desktop.
how to override a function in rails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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