Module: ActsAsTaggableOn::Taggable::Ownership::ClassMethods

Defined in:
lib/acts_as_taggable_on/taggable/ownership.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_taggable_on(*args) ⇒ Object


14
15
16
17
# File 'lib/acts_as_taggable_on/taggable/ownership.rb', line 14

def acts_as_taggable_on(*args)
  initialize_acts_as_taggable_on_ownership
  super(*args)
end

#initialize_acts_as_taggable_on_ownershipObject


19
20
21
22
23
24
25
26
27
# File 'lib/acts_as_taggable_on/taggable/ownership.rb', line 19

def initialize_acts_as_taggable_on_ownership
  tag_types.map(&:to_s).each do |tag_type|
    class_eval <<-RUBY, __FILE__, __LINE__ + 1
      def #{tag_type}_from(owner)
        owner_tag_list_on(owner, '#{tag_type}')
      end
    RUBY
  end
end