Forum: Ruby on Rails attribute select problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ivan M. (Guest)
on 2006-04-03 19:23
Hi,

I'm searching a metod to do a selection suck as:

Select attribute1,attribute2
 from table
  where conditions

I know that the "find()" and "find_by_sql" methods takes all the
attribute...But i want only attribute1 and attribute2...Can someone tell
me if there's a method that give me this opportunity?

Thanks,Ivan.
Agnieszka F. (Guest)
on 2006-04-03 22:04
Ivan M. wrote:
> Hi,
>
> I'm searching a metod to do a selection suck as:
>
> Select attribute1,attribute2
>  from table
>   where conditions
>
> I know that the "find()" and "find_by_sql" methods takes all the
> attribute...But i want only attribute1 and attribute2...Can someone tell
> me if there's a method that give me this opportunity?
>
> Thanks,Ivan.

Hi,

you can use find(:select => "attribute1, attribute2", ...)

--
Agnieszka
This topic is locked and can not be replied to.