Module: HasMachineTags::Console::ClassMethods

Defined in:
lib/has_machine_tags/console.rb

Instance Method Summary collapse

Instance Method Details

#find_and_change_tag(old_tag, new_tag) ⇒ Object

Updates items tagged with an old tag to use the given new tag in place of the old tag.



37
38
39
40
41
# File 'lib/has_machine_tags/console.rb', line 37

def find_and_change_tag(old_tag, new_tag)
  results = tagged_with(old_tag)
  results.each {|e| e.tag_add_and_remove(old_tag, new_tag)}
  puts "Changed tag for #{results.length} records"
end