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

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.
Jon M. (Guest)
on 2006-03-14 22: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....
James L. (Guest)
on 2006-03-14 22:50
(Received via mailing list)
On 3/14/06, Jon Mr <removed_email_address@domain.invalid> 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, p.id]

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

-- James
Jon M. (Guest)
on 2006-03-14 22:56
hey thanks! that's what i needed
This topic is locked and can not be replied to.