Batch tagging through console

Something quick that I think will work. Might want to verify against a couple of records first before uncommenting the line to add the tag.

tag = Tag.find_by(name: 'soundcloud')
category = Category.find_by(name: 'music')

Topic.where(category: category).each do |topic|
  if topic.first_post.raw =~ /<your keyword here>/
    puts topic.first_post.raw
    # topic.tags << tag
  end
end
7 Likes