0 votes
in Ruby by
How would you generate a drop-down menu that allows the user to select from a collection of product names?

 a. <%= select_tag(@products) %>

 b. <%= collection_select(@products) %>

 c. <select name="product_id"> <%= @products.each do |product| %> <option value="<%= product.id %>"/> <% end %></select>

 d. <%= collection_select(:product, :product_id, Product.all, :id, :name) %>

1 Answer

0 votes
by

How would you generate a drop-down menu that allows the user to select from a collection of product names?

 

 Correct answer is :-  <%= collection_select(:product, :product_id, Product.all, :id, :name) %>

Related questions

+1 vote
asked Aug 26, 2022 in Ruby by Robin
+1 vote
asked Aug 26, 2022 in Ruby by Robin
...