Module: MakeTaggable::Taggable::Related::ClassMethods

Defined in:
lib/make_taggable/taggable/related.rb

Instance Method Summary collapse

Instance Method Details



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/make_taggable/taggable/related.rb', line 9

def initialize_make_taggable_related
  tag_types.map(&:to_s).each do |tag_type|
    class_eval <<-RUBY, __FILE__, __LINE__ + 1
      def find_related_#{tag_type}(options = {})
        related_tags_for('#{tag_type}', self.class, options)
      end
      alias_method :find_related_on_#{tag_type}, :find_related_#{tag_type}

      def find_related_#{tag_type}_for(klass, options = {})
        related_tags_for('#{tag_type}', klass, options)
      end
    RUBY
  end
end

#make_taggable(*args) ⇒ Object



24
25
26
27
# File 'lib/make_taggable/taggable/related.rb', line 24

def make_taggable(*args)
  super(*args)
  initialize_make_taggable_related
end