Module: ActsAsOrganizable::ActiveRecordExtension
- Defined in:
- lib/acts_as_organizable.rb
Instance Method Summary collapse
Instance Method Details
#acts_as_organizable(*kinds) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/acts_as_organizable.rb', line 26 def acts_as_organizable(*kinds) # Example: acts_as_organizable :tags, :languages class_inheritable_accessor :tag_kinds self.tag_kinds = kinds.map(&:to_s).map(&:singularize) self.tag_kinds << :tag if kinds.empty? include ActsAsOrganizable::TaggableMethods end |
#acts_as_tagger(opts = {}) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/acts_as_organizable.rb', line 35 def acts_as_tagger(opts={}) class_eval do has_many :owned_tags, :through => :owned_taggings, :source => :tag, :class_name => "Tag", :uniq => true has_many :owned_taggings, opts.merge(:as => :owner, :dependent => :destroy, :include => :tag, :class_name => "Tagging") end end |