[Rails] ActiveRecord selecting multiple fields
Bruno Mattarollo
bmatt at mac.com
Sun Nov 7 13:32:20 GMT 2004
Hello,
I have a model for a Person and I am trying to get the "first_name" and
the "last_name" which I have in different columns in a table. Is this
the most efficient way?
def self.getFullName(user_id)
find(user_id).first_names + " " + find(user_id).last_name
end
I assume that this makes two queries ... I would like to only make one
(also for future stuff ... how do I make this more efficient?)
Thank you in advance,
/B
--
Bruno Mattarollo <bmatt at mac.com>
Currently in: Sydney, Australia
[ http://pokies.typepad.com/virtual_possum/ ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 163 bytes
Desc: This is a digitally signed message part
Url : http://one.textdrive.com/pipermail/rails/attachments/20041108/90c4605a/PGP.bin
More information about the Rails
mailing list