LucasMelo
LucasMelo

Reputation: 117

name and id for a select_tag in rails search_form

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,

Upvotes: 0

Views: 692

Answers (1)

Santhosh
Santhosh

Reputation: 29174

Try this

select_tag "product_modules[product_id]", options_from_collection_for_select(Product.order(:name), :id, :name)

Upvotes: 3

Related Questions