您好我在建筑表格中使用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