collection_select 中的参数错误数量错误

Wrong number of Arguments error in collection_select

我有一个表格;

<%= form_for @boats do |f| %>

<%= f.collection_select(:brand, :brand_id,  @brands,  :id, :name, {:prompt   => "Select a Brand"}, {:id => 'brands_select'}) %>

<%= f.collection_select(:year, :year_id, @years, :id, :name, {:prompt   => "Select a Year"}, {:id => 'years_select'}) %>

<%= f.collection_select(:model, :model_id, @models, :id, :name, {:prompt   => "Select a Model"}, {:id => 'models_select'}) %>
<%= f.submit "Create my account" %>

    <% end %> 

并有控制器#index;

def index
    @boats = Boat.new
    @brands  = Brand.all
    @years = Year.all
    @models   = Model.all
  end

但这里的问题是,当我 运行 代码时,它给出了一个错误;

所以我不知道该怎么做。基本上,数据来自数据库,我想将它们保存到 Boat 数据库,其中列名是品牌、年份和型号。

参数的正确顺序是:

method, collection, value_method, text_method, options = {}, html_options = {}

即:

<%= f.collection_select :brand_id, @brands, :id, :name, {prompt: 'Select a Brand'}, {id: 'brand_select'} %>