Hi,
Could anybody cast some light on these:
1. How can I set a default value in a collection_select? To be specific, I
have a class ''Platform'', and I want to set the platform_code
(a field of
Platform) to be ''ORA'' (which exists in the Platform table).
I tried many variations of the following code in my view, but in vain:
<% @selected = ''ORA'' %>
<%= collection_select "sac_table_platform",
"platform_code",
Platform.find(:all, :order => "platform_code"),
:platform_code, :platform_code, { :selected => @selected } %>
2. How can I build my own list of collection_select, e.g., a list of three
people, say, to show [Adam, Bob, Charley] on the collection_select for the
corresponding values [''A'', ''B'',
''C''] in a table (which already exists), and
use it in my view?
Thanks,
Arif
--
View this message in context:
http://www.nabble.com/Setting-a-default-value-in-collection_select-tf4589956.html#a13102355
Sent from the RubyOnRails Users mailing list archive at Nabble.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
-~----------~----~----~----~------~----~------~--~---