Hi There,

I got stuck in a Problem with  Active Record Associations.

There are some Meals and each meal has many sides.

But it's only this single direction - so a side don't need to belong
to the meal. I don't wanna search: "Give me the meals where side
is ..."

I'll show you the problem with an example:

Meal 1:
  Side_8
  Side_10
  Side_11

Meal 2:
  Side_2
  Side_8
  Side_10

So one Side could be associated with many meals.

But I'm not shure how to create this with active Record.

I thought it should be enough to do this:

class Meal < ActiveRecord::Base
  has_many :sides
end

class Side < ActiveRecord::Base
end

But the meal_id is saved at the Side - so a side will only belong to
the last associated Meal - am I right?

Thanks allot for your help
Chris

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to