On 4 October 2011 21:40, Colin Law <[email protected]> wrote:
> On 4 October 2011 21:35, Jim Burgess <[email protected]> wrote:
>> I have the following associations in my models:
>>
>> item.rb
>> belongs_to :manufacturer, :class_name => "Company"
>> belongs_to :distributor, :class_name => "Company"
>>
>> company.rb
>> has_many :items
>>
>> My question: what is the best way to find all of the items belonging to
>> a specific company?
>
> If you have a company in @company (for example) then that companies
> items are @company.items.
> Similarly for an @item its company is @item.company

On second thoughts perhaps *I* would benefit from reading your
question more carefully.

You have a problem with your associations, for company you need to
specify two associations for the two associations to item.  I need to
just check exactly what you need to do....

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.

Reply via email to