How can I set attribute of join model in a has many through association?

I have:

class Ruser < ActiveRecord::Base
has_many :deliveries
has_many :bags, :through => :deliveries

class Bag < ActiveRecord::Base
has_many :deliveries
has_many :rusers, :through => :deliveries

class Delivery < ActiveRecord::Base
belongs_to :ruser
belongs_to :bag

Delivery has an extra attribute :delivered_at of type date.

I have Ruser and Bag already populated.
I want to assign bags to rusers simultaneously setting delivered_at.
Doing user.bags << bags doesn’t allow to set delivered_at.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs