Collection_select with a mix of AR models and non AR models


#1

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.