On 3/14/06, Jon Mr <jon.druse@gmail.com> wrote:> 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....
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