Select in rails simple_form gives nil irrespective of option selected

125 Views Asked by At

Hi I am using simple_form in building forms. In select menu I get nil value for team_size irrespective of the option choosen by the user. Why does this happen. Could anyone help me out. This is my form:

.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
0

There are 0 best solutions below