I am very frustrated with :joins in a find. @debts = Debtortranstaxes.find(:all, :conditions => ["trandate > ? and trandate <= ?", @per1, @per2], :joins => 'LEFT JOIN debtortrans ON debtortrans.id=debtortransid', :order => 'trandate, transno') => [#<Debtortranstaxes debtortransid: 67, taxauthid: 26, taxamount: 0.63>, #<Debtortranstaxes debtortransid: 67, taxauthid: 34, taxamount: 0.2>, #<Debtortranstaxes debtortransid: 68, taxauthid: 24, taxamount: 3.15>, #<Debtortranstaxes debtortransid: 68, taxauthid: 32, taxamount: 0.825>, #<Debtortranstaxes debtortransid: 69, taxauthid: 24, taxamount: 756.0>, #<Debtortranstaxes debtortransid: 69, taxauthid: 32, taxamount: 198.0>]
but this does not contain the columns from debtortrans table...even if I specifically name them with a :select => in the console, I can get the value @debts[0].trandate but inside a loop, the value is not available to me... for debt in @debts if debt.trandate = ... it simply tosses an undefined method error How do I get all of the fields returned from joined tables in query? Craig -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

