我有这个表单并尝试了很多方法,但都无济于事,无法在提交后重新填充 rails form_for 的表单字段。正确的方法是什么?也许只是忽略了文档,但没有很好的参考如何做到这一点:(
唯一不起作用的解决方案是使用 params 标记并将集合默认值设置为该值,但如果未提交表单,这也会失败。参数[:age_from]
= form_for :people, :url => request.fullpath, :method => :get, :html => { :class => 'form-search' } do |f|
#container_search
.clear
= select_tag(:age_from, options_for_select(18..60)
= select_tag(:age_to, options_for_select(18..60)
= select_tag(:gender, options_for_select(gender)
.clear
.center
= f.submit "Search »", :class => "span-4"