Hi all
I''m quite new to Rails an am managing an application, and I want to add
a "Not Selected" option to a dropdown-list.
As it stands now, once you''ve chosen an option in the dropdownlist the
value is stored in the database, and then it''s impossible to remove the
option unless you choose another option (Radiobutton-style). If no
option is selected, null is stored as that dropdown-lists value.
Therefor I need an "Not Selected"-option, that when selected would
save
the value null in the database.
There must''ve been plenty of cases where something similar to this has
been implemented before, yet I have failed to find any resources despite
searching for a good couple of hours.
This is how the form looks right now:
<%= account_pref.input "editorial_#{key}".to_sym, :as => :radio,
:collection => options_for(Editorial, key.to_sym), :wrapper_html => {
:class => "compact" }, :label => key.titleize %>
What I was thinking was that maybe there''s some method similar to the
option_for one , so that I could add a "Not Stated" option to the
collection, and then somehow link its value to null.
If anyone can either give me some direct tips for solutions, or a place
to find a good resource on this, I''d be very happy.
Regards,
Emil
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.