On Jan 24, 12:48 pm, Mauro <[email protected]> wrote:
> Now I want delivery 3 bags to ruser.
> I can do
> bags=Bags.all
> user=Ruser.find(params[:id])
> delivery = user.deliveries.create(:delivered_at => Date.today).
> But I can't do delivery.bags << bags.
> I think that could be some mistakes in my associations.

You've written that deliver belongs_to bag (ie there is at most one
bag for a delivery). With the way your models currently exist, you'd
need to create one delivery for each bag.

Fred

-- 
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