I have the model kit which has_and_belongs_to_many products.
I want to add all of the product_ids the kit has into a link_to path.
<%= link_to "<button>Personalizar este pack</button>".html_safe, kit_builder_path(kit_id: @kit.id, products_ids: @kit.products, kit_name: @kit.name) %>
¿Do I need to loop through the @kit.products ids and inject them?
Thanks a lot
CodePudding user response:
You can do:
product_ids: @kit.products.collect(&:id)
