I am very confused about HABTM and a form select statement that I need
I have two objects - Person which has the following fields:
id, firstname, lastname, email
Category which has the following fields:
A person HABTM categories and also the reverse. I have setup the join
using a migration. All that went well.
Two questions - If I want to edit a person, how do I use some kind of
helper (collection_select?) to correctly create a multiple select
that has persons categories already selected? I can’t figure out that
syntax at all.
And, how do I get the results of that select back into the Person
In a controller, if I do this:
person.attributes = params[:person]
then the person object is expecting category objects, but of course it
getting strings from the select, so it doesn’t work.
I appreciate any help…