Help understanding select control in Phoenix

I am looking at an existing project and it renders a select control as follows:

              <label for="report_rating_type" class="control-label">Game type:</label>
              <%= select(
                :report,
                :rating_type,
                [
                  "All",
                  "Duel",
                  "Small Team",
                  "Large Team",
                  "FFA",
                  "Team FFA"
                ],
                class: "form-control",
                selected: @params["rating_type"]
              ) %>
            </div>

What are the first two arguments of the select supposed to be for? Is it just an id? I couldn’t find the appropriate documentation for the select control. Also the label for “report_rating_type” where is that pointing to?

It’s here Phoenix.HTML.Form — Phoenix.HTML v3.3.4. Those functions have been removed in the latest major release of the library, so you need to go back to find their documentation.

1 Like