Module: DataMapper::Is::Taggable::ClassMethods
- Defined in:
- lib/dm-is-taggable/is/taggable.rb
Instance Method Summary collapse
Instance Method Details
#taggable? ⇒ Boolean
59 60 61 |
# File 'lib/dm-is-taggable/is/taggable.rb', line 59 def taggable? true end |
#tagged_with(tags) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/dm-is-taggable/is/taggable.rb', line 63 def tagged_with() # tags can be an object or an array = [] unless .class == Array # Transform Strings to Tags if necessary .collect!{|t| t.class == Tag ? t : Tag.build(t)} # Query the objects tagged with those tags taggings = Extlib::Inflection::constantize("#{self.to_s}Tag").all(:tag_id.in => .collect{|t| t.id}) taggings.collect{|tagging| tagging.send(Extlib::Inflection::underscore(self.to_s)) } end |