When passing a string of options to select tag it appears it you need
to use raw.
This does not work
<%= select_tag "people",
"<option>David</option>" %>
This does
<%= select_tag "people",
raw("<option>David</option>") %>
Is this WAD? (Working As Designed).
example usage taken from
http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-select_tag
Creating options from options_for_select works fine but I have cases
where I usually add 1 option
options = ''<option value="">Select Duration (in
months)</option>'' +
options_for_select((min_contract_length..max_months).to_a,
item.months)
When I do this I need to do use raw.
<%= select_tag "months", raw(options) %>
Assuming this is WAD the documentation should probably be updated.
Is there a better way to do what I am doing above (adding an option to
the options_for_select output)?
Thanks
Tony Primerano
--
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.