simple_form设置整数集合的默认值失败,为什么?

时间:2013-10-11 17:00:42

标签: collections default simple-form

尝试在simple_form中为整数集合设置选定的值总是失败!为什么这非常令人沮丧而且不明白为什么。

打印@ profile.age在视图中它是正确的值19

查看:

  = f.input :age_from,
            :collection => 18..60,
            :selected => @profile.age

结果:

 defaults to 18

查看:

  = f.input :age_from,
            :collection => 18..60,
            :selected => "#{@profile.age}"

结果:

 to defaults to 18

添加:selected => “#{@ profile.age.to_s}

结果:

defaults to 18

0 个答案:

没有答案
相关问题