Collection_select option with multiple symbols


#1

i have this collection_select:

<%= f.label :customer, t(‘admin.customers.index.items’) %>

<%= f.collection_select( :customer, @customers, :id, :surname, options
= {:prompt => t(‘admin.customers.index.item’) } ) %>

and i want to obtain this in my html:

… surname name company …

i tryed:
<%= f.label :customer, t(‘admin.customers.index.items’) %>

<%= f.collection_select( :customer, @customers, :id, :surname + :name

  • :company , options = {:prompt => t(‘admin.customers.index.item’) } )
    %>

but it isn’t possible. ho can i do?


#2

Here’s how it would look like:

<%= f.label :customer, t(‘admin.customers.index.items’) %>

<%= f.select( :customer, @customers.map {|c| ["#{c.surname} #{c.name}

  • #{c.company}", c.id] } ) %>

Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/
(en)

On Mon, Jun 1, 2009 at 2:44 PM, Aldo I.


#3

muito obrigado :slight_smile: