Hey guys,
Maybe someone could point out what wrong here. I’ve simplified the issue
to this:
Both User.find(6) and Sport.find(1) exist, Im just trying to setup the
relationship between them.
My controller looks like this
def tester
@c = User.find(6)
@c.sports = Sport.find(1)
end
And I keep getting this error:
undefined method `each’ for #<Sport:0x36a3488
@attributes={“name”=>“Basketball”, “id”=>“1”}>
Im pretty sure that I set up the database right. I have a sports_users
table with sport_id and user_id. And when I put records into the
database manually, the records are finding each other, Im just having
trouble getting this to work from a submit form. Anybody encounter this?