Noob question about find()?


#1

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’ }) %>

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…


#2

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


#3

hey thanks! that’s what i needed