Created
May 17, 2010 11:05
-
-
Save littlemove/403648 to your computer and use it in GitHub Desktop.
This file contains 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 Categorizable | |
def self.included(base) | |
base.has_many :audience_scopes, :as => :audienciable | |
base.has_many :audience_categories, :through => :audience_scopes | |
base.has_many :areas, :through => :audience_scopes | |
... | |
base.send :extend, ClassMethods | |
end | |
module ClassMethods | |
def acts_as_categorizable | |
send :include, InstanceMethods | |
end | |
def for_user(user) | |
... | |
end | |
end | |
module InstanceMethods | |
def related | |
... | |
end | |
end | |
end | |
ActiveRecord::Base.send :include, Categorizable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment