On 14 January 2012 16:59, Fritz Rodriguez <[email protected]> wrote: > Colin Law wrote in post #1040834: >> On 14 January 2012 04:12, Fritz Rodriguez <[email protected]> wrote: >>> >>> class NameAlias < ActiveRecord::Base >>> belongs_to :work_order >>> has_many :sub_tasks >>> end >>> >>> class SubTask < ActiveRecord::Base >>> belongs_to :name_alias >>> belongs_to :work_order >> >> This should be belongs_to :through name_alias. It must mirror the >> has_many sub_tasks :through in work_order >> >> You should really have started a new thread for this as it is nothing >> to do with the original post. >> >> Colin > > Colin, Thanks for your reply and my apologies regarding proper placement > of the is post. > > I believe you said the SubTask model should mirror through in > work_order? > > class SubTask < ActiveRecord::Base > attr_accessible :name_alias_id, :work_order_id, :status, :title > > belongs_to :name_alias > belongs_to :work_order, :through => :name_alias > > accepts_nested_attributes_for :name_alias > accepts_nested_attributes_for :work_order > > This produced a "Unknown key: through" error? Not sure I place the > association in the correct model, I have attached a file for reference.
Sorry, I was talking drivel. belongs_to :through is not supported. You should just have belongs_to :name_alias. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

