Damaris Fuentes
2007-Mar-20 22:32 UTC
Collection_select with a mix of AR models and non AR models
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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---