# Collection\_select option with multiple symbols

**URL:** <https://www.ruby-forum.com/t/collection-select-option-with-multiple-symbols/169276>\
**Category:** Rails\
**Created:** [June 1, 2009, 7:44pm UTC](https://www.ruby-forum.com/t/collection-select-option-with-multiple-symbols/169276 "2009-06-01T19:44:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aldoitalo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@aldoitalo](https://www.ruby-forum.com/u/aldoitalo)\
**Post date:** [June 1, 2009, 7:44pm UTC](https://www.ruby-forum.com/t/collection-select-option-with-multiple-symbols/169276/1 "2009-06-01T19:44:43Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![aldoitalo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@aldoitalo](https://www.ruby-forum.com/u/aldoitalo)\
**Post date:** [June 1, 2009, 8:10pm UTC](https://www.ruby-forum.com/t/collection-select-option-with-multiple-symbols/169276/2 "2009-06-01T20:10:33Z")

</div>

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/](http://alinhavado.wordpress.com/) (pt-br) | [http://blog.codevader.com/](http://blog.codevader.com/)  
(en)

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

---

<div class="post-metadata">

**Author:** ![aldoitalo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@aldoitalo](https://www.ruby-forum.com/u/aldoitalo)\
**Post date:** [June 1, 2009, 8:18pm UTC](https://www.ruby-forum.com/t/collection-select-option-with-multiple-symbols/169276/3 "2009-06-01T20:18:12Z")

</div>

muito obrigado 🙂
