Select specified fields from a record


#1

ok, here is my question, how can i select only one or two, three… etc
fields from a sentence, for example, i only want to know the id, name
from de User model

User.find(:first, :condiions => [“id = ?”, @id])

how can i specify what fields i want??


#2

On May 9, 2006, at 10:33 AM, sergio luis wrote:

ok, here is my question, how can i select only one or two, three… etc
fields from a sentence, for example, i only want to know the id, name
from de User model

User.find(:first, :condiions => [“id = ?”, @id])

how can i specify what fields i want??

Please refer to the API docs:
http://api.rubyonrails.com/classes/ActiveRecord/Base.html#M000860

Also, be mindful that the forum is mirrored to a mailing list -
“throwaway” questions really gum up the works.

Thanks,
jeremy