Module: Taggable::Model::TaggableClassMethods

Defined in:
lib/taggable/model.rb

Instance Method Summary collapse

Instance Method Details

#has_tags?Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/taggable/model.rb', line 94

def has_tags?
  true
end

#tagged_with(somewords = []) ⇒ Object



84
85
86
87
88
89
90
91
92
# File 'lib/taggable/model.rb', line 84

def tagged_with(somewords=[])
  if somewords.is_a?(Tag)
    self.from_tag(somewords)
  elsif somewords.is_a?(Array)
    self.from_all_tags(somewords)
  else
    self.from_all_tags( Tag.from_list(somewords) )
  end
end

#tags_for_cloud_from(these, limit = 50) ⇒ Object



98
99
100
# File 'lib/taggable/model.rb', line 98

def tags_for_cloud_from(these, limit=50)
  Tag.attached_to(these).most_popular(limit)   # here popularity is use-count *within the group*
end