I have a Model called Category and other Model Product. They have has_many and belongs_to relation. But code in my view
<p><%= f.collection_select(:product, :category_id, Category.all, :id, :name)%>
is giving me
undefined method `merge' for :name:Symbol
Any clue what is wrong with it?
Chances are you have something like this:
Because
f
is already tied toproduct
, you don't need to include it as your first argument, so it should just be:Or, you could not use
f.
: