Pregunta

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?

¿Fue útil?

Solución

category = Category.find(4)
[15, 16].each{|k| Award.find(k).categories << category }
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top