Created
May 22, 2012 00:25
-
-
Save chancancode/2765666 to your computer and use it in GitHub Desktop.
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
module MyModule | |
def clean_options | |
# Just an example helper method | |
# Don't want this to pollute the AR::Base namespace | |
end | |
def do_other_stuff | |
# Another helper method | |
end | |
module ActiveRecordExtensions | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def has_awesome_properties(options) | |
# class A < AR::Base | |
# has_awesome_properties :some => options | |
# end | |
options = clean_options(options) | |
do_other_stuff | |
end | |
end | |
end | |
end | |
class ActiveRecord::Base | |
include MyModule::ActiveRecordExtensions | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment