Rails options_for_select with selected model value -
there following code:
f.select :engine_value, options_for_select(engine_values_select_items)
as can see, it's select list options. problem if form object has got float value in engine_value value not selected in select tag. how can fix this?
code engine_values_select_items:
def engine_values_select_items (1..6).step(0.1).to_a.map{|s| [s.round(2), s.round(2)]} end
i thought rails did default, perhaps wrong?
i can remember myself dealing issues. imho in cases approach followed meet expectations similar "generators" , combinations of them.
there another post might you.
also not forget check out proper syntax (i talking order).
then, try using "selected: " see how go.
hope helps,
Comments
Post a Comment