I have Ruser and Bag models.
I’m using Ruser instead of User because I know “user” create problems
with a postgresql database.
Bags must be delivered to Ruser so I need to know when one or more
bags are delivered.
I create these associations:
class Ruser < ActiveRecord::Base
has_many :bags, :through => :deliveries
class Bag < ActiveRecord::Base
has_many :rusers, :through => :deliveries
class Delivery < ActiveRecord::Base
Ruser and Bag are already populated.
Delivery has delivered_at attribute.
Now I want delivery 3 bags to ruser.
I can do
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.