How do I put name and id on a select_tag? I tried this way but i only got syntax error,

 <%= select_tag :product_id, options_from_collection_for_select(Product.order(:name), :id, :name, params[:product_modules][:product_id]), id: "product_modules[product_id]", { include_blank: true } %>

Thanks,

有帮助吗?

解决方案

Try this

select_tag "product_modules[product_id]", options_from_collection_for_select(Product.order(:name), :id, :name)
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top