Shih Tony wrote:> Hi.
> I have two tables: users and pens.
> the relationship of user and pen is one to many.
> In controller, the return value is @pens(all pens belong to a specific
> user), but in view, i want to show out all pens'' value as default
in
> <select> form, how to handle it?
>
> Thank you!
look at options_for_select() and options_from_collection_for_select(),
both of which take a conditional select argument that automatically
"selects" the current value the model has.
hth
ilan
--
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
-~----------~----~----~----~------~----~------~--~---