Skip to content

Instantly share code, notes, and snippets.

@javier
Forked from littlemove/gist:403648
Created May 17, 2010 11:41
Show Gist options
  • Save javier/403676 to your computer and use it in GitHub Desktop.
Save javier/403676 to your computer and use it in GitHub Desktop.
module Categorizable
module ClassMethods
def acts_as_categorizable
has_many :audience_scopes, :as => :audienciable
has_many :audience_categories, :through => :audience_scopes
has_many :areas, :through => :audience_scopes
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