# Add symbol in collection\_select helper

**URL:** <https://www.ruby-forum.com/t/add-symbol-in-collection-select-helper/174283>\
**Category:** Rails\
**Created:** [August 24, 2009, 10:57am UTC](https://www.ruby-forum.com/t/add-symbol-in-collection-select-helper/174283 "2009-08-24T10:57:47Z")\
**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:** [August 24, 2009, 10:57am UTC](https://www.ruby-forum.com/t/add-symbol-in-collection-select-helper/174283/1 "2009-08-24T10:57:47Z")

</div>

hi,  
i have a collection\_select helper wich i retrieve a select multiple with  
the names of my reports:

\<%= f.collection\_select :report\_ids, @reports, :id, :name, {}, {  
:multiple =\> true, :size =\> 10 } %\>

but now i want to add the “surname” field to the list selectable.  
i have tryed:

\<%= f.collection\_select :report\_ids, @reports, :id, “#{:name}  
#{:surname}” , {}, { :multiple =\> true, :size =\> 10 } %\>

but i obtain an error.  
what is the correct sintax?

thanks

---

<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:** [August 24, 2009, 1:02pm UTC](https://www.ruby-forum.com/t/add-symbol-in-collection-select-helper/174283/2 "2009-08-24T13:02:37Z")

</div>

\<%= f.select :report\_ids, @reports.map { |r| [“#{r.name}  
#{r.surname}”, r.id] } , {}, :multiple =\> true, :size =\> 10 %\>

- 

Maurício Linhares  
[http://codeshooter.wordpress.com/](http://codeshooter.wordpress.com/) | [http://twitter.com/mauriciojr](http://twitter.com/mauriciojr)

On Mon, Aug 24, 2009 at 5:57 AM, Aldo

---

<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:** [September 19, 2009, 12:23am UTC](https://www.ruby-forum.com/t/add-symbol-in-collection-select-helper/174283/3 "2009-09-19T00:23:00Z")

</div>

hi  
I am new to rails, here why dont we use a method which is not a  
table attribute but a user defined one which is defined as we need  
like display of both surname and name concatenated.  
i tried but i am getting error pls clarify me thanks in advance
