Forum: Ruby on Rails Multiple inserts on a through association.

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
5deb69f3101597346558881a9cb302bf?d=identicon&s=25 Fernando Lujan (Guest)
on 2007-07-18 00:15
(Received via mailing list)
class Trunk < ActiveRecord::Base

  has_many :call_type_trunks
  has_many :call_types, :through => :call_type_trunks


class CallType < ActiveRecord::Base

  has_many :call_type_trunks
  has_many :trunks, :through => :call_type_trunks


class CallTypeTrunk < ActiveRecord::Base
  belongs_to :call_type
  belongs_to :trunk

The associaton class has a column named price. Each association
trunk/call_type will have a differente price.

When i choose to add a trunk. I want to list all call_types to allow
the users to add/edit both: the call_type ( associate or remove )
call_types to this trunk... and to edit price for each association
that exist.

How can I achieve this behavior?

Fernando Lujan
This topic is locked and can not be replied to.