"undefined method `each'" error is derailing me

This is a problem with your join table. HABTM is a dumb
join. The join table is only the two id’s of the things to
join. The join itself is not a rich model, and so the join model
shouldn’t include an id column.

This is an issue with your table decleration for the join table

create_table “people_projects”, :force => true do |t|

t.column "person_id",  :integer

t.column "project_id", :integer


Should be

create_table “people_projects”, :force => true, :id => false do |t|

t.column "person_id",  :integer

t.column "project_id", :integer


Sorry should have picked that up before.

If you want to have an id column and therefore a rich join model,
(ie one with it’s own logic and data) you should look at

has_many with the :through option

http://blog.hasmanythrough.com/ for more details

Yes, This just prevents the table from being created with an id column


You’re not really dealing with an array here, and if you do, you will only do so in memory at best. It will not persist.

In the docs


it says it should be

@project.people.delete( Person.find( params[:personid] ) )

Hope that gets you going.



Yes similar here. I’m sure it takes me a long time to get stuff
compared with ppl with a computer science degree behind them…
I’m a mechanical engineer and just play with this in my spare
time. Would be nice if it was otherwise…

Good luck with your project.