Select specified fields from a record

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??

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs