Forum: Ruby on Rails noob question about find()??

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
4108c0021c64d188494cae8dcfc95fd8?d=identicon&s=25 Jon Mr (jon-d)
on 2006-03-14 21:41
could anyone tell me why this doesn't work???

<%= select(:schedule, :employee_name, Employee.find(:all, :order =>
'last_name ASC').collect {|p| [p.first_name, p.last_name] }, {
:include_blank => 'true' })  %></p>

i mean it works half way, only the first name is displayed..
i've been at it for a while now.. the answer is probably right in front
of my face....
119af50160cabfe1fb6f2f05f5018c64?d=identicon&s=25 James Ludlow (Guest)
on 2006-03-14 21:50
(Received via mailing list)
On 3/14/06, Jon Mr <> wrote:
> of my face....
The array that you're generating  [p.first_name, p.last_name] means
that you want first_name to display and last_name to be used as the
"id" which probably isn't what you want.

Maybe:  [p.first_name + " " +  p.last_name,]

I'd also move most of this to helper methods, to clean this up.

-- James
4108c0021c64d188494cae8dcfc95fd8?d=identicon&s=25 Jon Mr (jon-d)
on 2006-03-14 21:56
hey thanks! that's what i needed
This topic is locked and can not be replied to.