フォームがあります。
<%= 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
しかし、ここでの問題は、コードを実行するとエラーが発生することです。
だから私は何をすべきかわからない。基本的に、データはデータベースから取得され、列名が Brand、Year、Model である Boat データベースに保存したいと考えています。