Module: DataMapper::Tags::SingletonMethods
- Defined in:
- lib/dm-tags/dm_tags.rb
Instance Method Summary collapse
- #taggable? ⇒ Boolean
-
#tagged_with(string, options = {}) ⇒ Object
Class Methods.
Instance Method Details
#taggable? ⇒ Boolean
16 17 18 |
# File 'lib/dm-tags/dm_tags.rb', line 16 def taggable? true end |
#tagged_with(string, options = {}) ⇒ Object
Class Methods
6 7 8 9 10 11 12 13 14 |
# File 'lib/dm-tags/dm_tags.rb', line 6 def tagged_with(string, = {}) tag = Tag.first(:name => string) conditions = { 'taggings.tag_id' => tag.kind_of?(Tag) ? tag.id : nil, 'taggings.taggable_type' => self, } conditions['taggings.tag_context'] = .delete(:on) if .key?(:on) all(conditions.update()) end |