I’m totally new to the rails console and I need to do something like this; tag all the posts in 8 categories with the title of each category and then once that has been done move all the posts in these 8 categories into an “Archived” category.
Would something like this work for the tagging of the posts in each category (since there are only 8 categories it doesn’t seem worth writing a loop)?
category = Category.find_by(name: 'oldstuff')
Topic.where(category: category).each do |topic|
topic.tags << oldstuff
end