<%= f.select 'difficulty', options_for_select({ "Easy" => "1", "Medium" => "3", "Hard" => "5"}, get_difficulty(@tour).to_s), :class =>'input_text' %>
Right way to do:
<%= select :tour, :difficulty, { "Easy" => "1", "Medium" => "3", "Hard" => "5"}, {:selected=>get_difficulty(@tour).to_s}, :class=>"input_text" %>
Now class is applied!!!
Any other better way pls tel me,,.</span>
3 comments:
Good catch Srikanth.
Looks like the kludge (bug workaround) is to add even just an empty hash {} argument before options. Seems to work for both FormHelper and FormBuilder (f.)
good catch, even a dummy arg {} will do it in helper or builder (f.)
{} does it also (f.)
Post a Comment