0

嗨,我在构建表单中使用 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
4

0 回答 0