Noob question about find()?

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…

On 3/14/06, Jon Mr [email protected] 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

hey thanks! that’s what i needed

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