On 24 Sep 2008, at 10:46, Frederick Cheung wrote:
> > On 24 Sep 2008, at 00:44, ressister wrote: > >> >> Right Heimdull, thanks. So my model setup is correct for what I'm >> trying to achieve you think? Any idea why this works: >> >> @first = Entry.find(:first, :include => :category) >> @first.category.name >> >> ...and this does not? >> >> @entries = Entry.sum(:price, :include => :category, :conditions => >> ['user_id = 1'], :group => 'categories.id') > > Because they are going down 2 different code paths. One is loading > the entry and then the category. The is trying to generate the > appropriate join statement. It just so happens that the latter is > bust in rails 2.1 for has_one :through associations (the former is > also broken but not in a noticeable way) > Forgot to add, 2.1.1 should fix this Fred > Fred >> >> >> It doesn't seem like my model setup is using the catogory_entries >> table successfully as a join table. Thoughts? >> >> -A >> >> On Sep 23, 7:10 pm, heimdull <[EMAIL PROTECTED]> wrote: >>>>> Categories doesn't have an entry_id, it doesn't seem to be >>>>> picking up >>>>> entry_category as the join table, though based on its naming, it >>>>> isn't >>>>> a traditional join table otherwise it would be called >>>>> category_entry. >>> >>> With the setup that Andres suggested you need a entry_id in the >>> categories table. >> >> > --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---