Skip to content

Instantly share code, notes, and snippets.

@jlebrech
Created January 30, 2013 10:15
Show Gist options
  • Save jlebrech/4672198 to your computer and use it in GitHub Desktop.
Save jlebrech/4672198 to your computer and use it in GitHub Desktop.
replacing tags doesn't persist in the database.
# loop through article containing the old_tag
Article.tagged_with(old_tag).each do |article|
# give articles with the old tag the new tag
article.tag_list.add(new_tag)
# remove the old tag
article.tag_list.remove(old_tag)
article.save # this isn't
end
# is this a similar problem? https://github.com/mbleigh/acts-as-taggable-on/issues/229
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment