Skip to content

Instantly share code, notes, and snippets.

@chancancode
Created May 22, 2012 00:25
Show Gist options
  • Save chancancode/2765666 to your computer and use it in GitHub Desktop.
Save chancancode/2765666 to your computer and use it in GitHub Desktop.
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