Created
January 10, 2016 14:10
-
-
Save aldesantis/1b3a1bcf7a1c8396552f 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 Crowdster | |
module ActsAsCampaigner | |
def included(klass) | |
klass.extend ClassMethods | |
end | |
module ClassMethods | |
def acts_as_campaigner | |
has_many :campaigns, class_name: 'Crowdster::Campaign' | |
end | |
end | |
end | |
end |
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 Crowdster | |
class Engine < ::Rails::Engine | |
isolate_namespace Crowdster | |
config.to_prepare do | |
ActiveRecord::Base.include Crowdster::ActsAsCampaigner | |
end | |
end | |
end |
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
class User < ActiveRecord::Base | |
acts_as_campaigner | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment