I generated through scaffolding products with name and price. In the
products/new’s partial _form.html.erb i made a slight change. Instead of
having the user to enter the product. I provide a drop down menu
replacing :
<%= f.text_field :name%> sets the params array as:
params[:product][:name] (provided you have written <%= form_for
:product,
… %>)
while <%= select_tag(:name,
options_for_select([‘Peas’,‘Butter’,‘Garlic’]))
%> sets the params array as:
params[:name] after submit.
Probably, you are accessing the wrong array index.