こんにちは、フォームの作成に simple_form を使用しています。選択メニューでは、ユーザーが選択したオプションに関係なく、team_size の値が nil になります。なぜこれが起こるのですか?誰でも私を助けてくれませんか。これは私のフォームです:
.centric
h2 Add new game
hr
= simple_form_for @game do |f|
- if @game.errors.any?
- @game.errors.full_messages.each do |msg|
li = msg
.pull-left
= f.input :name, label: "Game", required: true
= f.input :game_type, collection: game_type_map, label: "Type", required: true, include_blank: false
= f.input :played_by, collection: played_by_map, selected: "Select", label: "Played By", required: true
= f.input :team_size, collection: 1..12, selected: "Select", required: true
hr
= f.button :submit, "Add", class: 'btn btn-primary', data: {confirm: "Add Game?"}
| |
= link_to "Cancel", root_path