I have model Product with has_may :benefits, now in link_to for new benefit I don't know how to send ID of product so I can go with
Product.find(params[:id]).benefits.new(...)
Normal new method is
<%= link_to t('add_new_benefit'), new_admin_benefit_path %>
I want to send @product object so I can get id from it.
I wanna send it like this
<%= link_to t('add_new_benefit'), new_admin_benefit_path(@product) %>
routes.rb
...
namespace :admin do
root "action_logs#index"
get "toolkit", to: "toolkit#index"
resources :admins
resources :products
...
resources :benefits
end