2

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
4

0 に答える 0