Chances are you have something like this:
<%= form_for @product do |f| %>
Because f
is already tied to product
, you don't need to include it as your first argument, so it should just be:
<%= f.collection_select :category_id, Category.all, :id, :name %>
Or, you could not use f.
:
<%= collection_select :product, :category_id, Category.all, :id, :name %>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…