How can I set attributes in the intermediate table for a many-to-many situation? (e.g. when tryin


#1

Hi,

It seems for the model scenario I have below if there was NO “amount”
field
on AiAllocation I could go:
.business_items <<

QUESTION: What’s the easiest way to allocate an account item to a
business
item in this case. I really want something like:
.business_items << ,

Model Scenario (see below)

class AccountItem < ActiveRecord::Base
has_many :ai_allocations
has_many :business_items, :through => :ai_allocations

class AiAllocation < ActiveRecord::Base

  • Amount field *

belongs_to :account_item
belongs_to :business_item

class BusinessItem < ActiveRecord::Base
has_many :ai_allocations
has_many :account_items, :through => :ai_allocations

thanks


Greg
http://blog.gregnet.org/