Consider these routes:
resources :companies do member do post 'save_category' end end
This member block means that the save_category
route in the /compagnies/
namespace requires a company identifier to work:
/compagnies/12/save_category
Now, with the collection:
resources :companies do collection do post 'save_category' end end
This means that to go to the save_category route, you do not need a company identifier:
/compagnies/save_category
In your case , you should first use the URL helpers (generated after route.rb). You need here:
if save_category is a *member route* save_category_company_path(@company) elsif save_category is a *collection route* save_category_companies_path
I think the category you want to keep is related to a specific company, right? If so, do you need a member route:
form_tag(save_category_company_path(@company), method: "post") do
Hope this helps!
source share