Question

I have Awards - Awards_Categories - Categories in a HABTM association.

I updated my routes so that

resources :categories do
   resources :awards 
end

I have two awards that didn't have a category so now accessing them from the admin is not working.

How would mess with this in the console. Its pretty straight forward, I need award(15) and award(16) to have category 4...

ideas?

Was it helpful?

Solution

category = Category.find(4)
[15, 16].each{|k| Award.find(k).categories << category }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top