Class: Alchemy::Tag
- Inherits:
-
ActsAsTaggableOn::Tag
- Object
- ActsAsTaggableOn::Tag
- Alchemy::Tag
- Defined in:
- app/models/alchemy/tag.rb
Class Method Summary collapse
-
.replace(tag, new_tag) ⇒ Object
Replaces tag with new tag on all models tagged with tag.
Class Method Details
.replace(tag, new_tag) ⇒ Object
Replaces tag with new tag on all models tagged with tag.
14 15 16 17 18 19 20 |
# File 'app/models/alchemy/tag.rb', line 14 def self.replace(tag, new_tag) tag.taggings.collect(&:taggable).each do |taggable| taggable.tag_list.delete(tag.name) taggable.tag_list << new_tag.name taggable.save end end |