Module HasMachineTags::Console::ClassMethods

  1. lib/has_machine_tags/console.rb

Methods

public instance

  1. find_and_change_tag

Public instance methods

find_and_change_tag (old_tag, new_tag)

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

[show source]
# 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