Ben Lisbakken wrote:> @document_pages, @documents = paginate :documents, :per_page => 20,
> :joins => "LEFT JOIN companies ON companies.id =
documents.company_id",
> :conditions => "doc_type_id =
''#{@doc_type_id}''", :order =>
> "companies.name asc"
>
> The problem with this segment of code is that when I try to display a
> document''s ID number, it displays the companies'' ID
number, since the
> join overwrites @documents.id with companies.id.
>
> How can I prevent this?
>
> Thanks,
> Ben Lisbakken
If you are doing the join just so that you can sort on companies.name,
then I suppose the easiest thing is to use :select =>
''documents.*''
Fred
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---