usually in form_for
I do p.text_field :my_colum_name
but what if I have a select tag?
I tried following but did not work
<%=p.select_tag :conditions,options_for_select([ "a", "b", "c" ], "a") %>
it says select_tag is an undefined method
usually in form_for
I do p.text_field :my_colum_name
but what if I have a select tag?
I tried following but did not work
<%=p.select_tag :conditions,options_for_select([ "a", "b", "c" ], "a") %>
it says select_tag is an undefined method
never mind.
<%=p.select_tag :conditions,options_for_select([ "a", "b", "c" ], "a") %>
works
What you want is this:
<%= p.select :conditions, [ "a", "b", "c" ] %>
Two changes: (1) select
is the method name when using a FormBuilder, and (2) it takes an array of options, without options_for_select
(it knows the current value from the object stored in the FormBuilder).