Module: Tagtical::Taggable::Related::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#acts_as_taggable(*args) ⇒ Object



33
34
35
36
# File 'lib/tagtical/taggable/related.rb', line 33

def acts_as_taggable(*args)
  super(*args)
  initialize_tagtical_related
end


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/tagtical/taggable/related.rb', line 10

def initialize_tagtical_related
  tag_types.each do |tag_type|
    class_eval "      def find_related_\#{tag_type.pluralize}(options = {})\n        related_tags_for('\#{tag_type}', self.class, options)\n      end\n      alias_method :find_related_on_\#{tag_type.pluralize}, :find_related_\#{tag_type.pluralize}\n\n      def find_related_\#{tag_type.pluralize}_for(klass, options = {})\n        related_tags_for('\#{tag_type}', klass, options)\n      end\n\n      def find_matching_contexts(search_context, result_context, options = {})\n        matching_contexts_for(search_context.to_s, result_context.to_s, self.class, options)\n      end\n\n      def find_matching_contexts_for(klass, search_context, result_context, options = {})\n        matching_contexts_for(search_context.to_s, result_context.to_s, klass, options)\n      end\n    RUBY\n  end        \nend\n", __FILE__, __LINE__ + 1