Afficher un message
Vieux 12/03/2008, 14h57   #2
David Palm
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Active-Record Sql: selecting only few columns

:select should be your friend here.

On Wed, 12 Mar 2008 21:27:51 +0900, Rajat Garg wrote:
> Hi Guys,
>
> I am writing a sql query -
> User.find(:all, rder=> 'u.created_on DESC', :limit =>2,
> :joins => "as u left join photos p on u.id = p.user_id")
>
> But i want this query to return only 3 parameters (name, photo_url, id)
> instead of all. Is there any ActiveRecord Way of selecting only those
> fields.
>
> I will really appreciate your .
>
> Thanks


  Réponse avec citation
 
Page generated in 0,05501 seconds with 9 queries