Module: ActsAsTaggableOn::Taggable
- Defined in:
- lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb,
lib/acts_as_taggable_on/social_stream.rb
Defined Under Namespace
Modules: Dirty
Instance Method Summary collapse
Instance Method Details
#acts_as_taggable_on(*tag_types) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/acts_as_taggable_on/social_stream.rb', line 59 def acts_as_taggable_on(*tag_types) tag_types = tag_types.to_a.flatten.compact.map(&:to_sym) if taggable? self.tag_types = (self.tag_types + tag_types).uniq else class_attribute :tag_types self.tag_types = tag_types class_eval do has_many :taggings, :as => :taggable, :dependent => :destroy, :include => :tag, :class_name => "ActsAsTaggableOn::Tagging" has_many :base_tags, :through => :taggings, :source => :tag, :class_name => "ActsAsTaggableOn::Tag" def self.taggable? true end include ActsAsTaggableOn::Utils include ActsAsTaggableOn::Taggable::Core include ActsAsTaggableOn::Taggable::Collection include ActsAsTaggableOn::Taggable::Cache include ActsAsTaggableOn::Taggable::Ownership include ActsAsTaggableOn::Taggable::Related include ActsAsTaggableOn::Taggable::Dirty end end end |