Hello,
I''m having problems with form select tag (it wont select the expected
value on edit action):
<% form_for @review do |f| %>
<p>
<%= f.label :customer_service_rating %><br />
<%= f.select :customer_service_rating, options_for_select(1..5), {
:include_blank => true } %>
</p>
<% end %>
review model has a customer_service_rating column which is an integer.
If I set this value to some number betwen 1-5 it wont select it on edit.
What am I doing wrong here?
Thanks for help!
--
Posted via http://www.ruby-forum.com/.
This wont work either:
<% f.select :customer_service_rating, options_for_select(1..5), {
:selected => 2 }
%>
--
Posted via http://www.ruby-forum.com/.
Use: <%= f.select(:customer_service_rating, (1..5).to_a) %> On Nov 13, 12:42 pm, "Al F." <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> This wont work either: > > <%> f.select :customer_service_rating, options_for_select(1..5), { > :selected => 2 } > %> > -- > Posted viahttp://www.ruby-forum.com/.
Or, more completely:
<%= f.select(:customer_service_rating, (1..5).to_a,
{ :include_blank => true, :selected => 2 } ) %>
On Nov 13, 7:34 pm, Rick
<richard.t.ll...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Use:
>
> <%= f.select(:customer_service_rating, (1..5).to_a) %>
>
> On Nov 13, 12:42 pm, "Al F."
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:
>
> > This wont work either:
>
> > <%> > f.select :customer_service_rating,
options_for_select(1..5), {
> > :selected => 2 }
> > %>
> > --
> > Posted viahttp://www.ruby-forum.com/.