# Multiple inserts on a through association

**URL:** <https://www.ruby-forum.com/t/multiple-inserts-on-a-through-association/109693>\
**Category:** Rails\
**Created:** [July 18, 2007, 12:15am UTC](https://www.ruby-forum.com/t/multiple-inserts-on-a-through-association/109693 "2007-07-18T00:15:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flopezr333](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/54ee81/32.png) [@flopezr333](https://www.ruby-forum.com/u/flopezr333)\
**Post date:** [July 18, 2007, 12:15am UTC](https://www.ruby-forum.com/t/multiple-inserts-on-a-through-association/109693/1 "2007-07-18T00:15:42Z")

</div>

class Trunk \< ActiveRecord::Base

has\_many :call\_type\_trunks  
has\_many :call\_types, :through =\> :call\_type\_trunks

end

class CallType \< ActiveRecord::Base

has\_many :call\_type\_trunks  
has\_many :trunks, :through =\> :call\_type\_trunks

end

class CallTypeTrunk \< ActiveRecord::Base  
belongs\_to :call\_type  
belongs\_to :trunk  
end

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