# Collection\_select with a mix of AR models and non AR models

**URL:** <https://www.ruby-forum.com/t/collection-select-with-a-mix-of-ar-models-and-non-ar-models/89516>\
**Category:** Rails\
**Created:** [March 20, 2007, 11:32pm UTC](https://www.ruby-forum.com/t/collection-select-with-a-mix-of-ar-models-and-non-ar-models/89516 "2007-03-20T23:32:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![damaris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@damaris](https://www.ruby-forum.com/u/damaris)\
**Post date:** [March 20, 2007, 11:32pm UTC](https://www.ruby-forum.com/t/collection-select-with-a-mix-of-ar-models-and-non-ar-models/89516/1 "2007-03-20T23:32:58Z")

</div>

Hi you all,

Having into account the following:

\<%= collection\_select(“page”, “subjects” , @subjects, “id”, “name”) %\>

and that “Page” is an AR model with an attr. accesor called “subjects”,  
array composed by non AR model objects (“Subject” is a model  
representing a file), my question is:  
I can get all my @subjects from my file but, how can I set the id and  
name? Is it enough to add a “def id” and “def name” methods in my non-AR  
model in order to my view get these att. right? Becuase if I have to use  
“select” I can not provide any value at all (I mean, the id and name),  
can I?

Thanks.
