routing - How do I specify an action on a resource in a namespace in rails 3? -


I have a resource: Products in a namespace: shop, like this:

  Namespace: Resources for stores: Product root: from = & gt; 'Products # Index' and  

While walking on Rock routes it displays in the following form:

  edit_shop_product GET / Shop / Products /: Id / edit (.: Format) {: action = & gt; "Edit",: admin = & gt; "Shop / products"}  

But when I use edit_shop_product_path in a partial view, like this:

  & Lt;% = button_to "edit", edit_shop_product_path (product)%>  

I get an action controller exception: no path matching "/ store / product / 1 / edit"

what is missing?

OK, I finally got the answer. The problem is the default for generating POST http requests that is the button_to method. Find it like this:

  & lt;% = button_to "edit", edit_shop_product_path (product),: method = & gt; :% & Gt; It has been advertised using the  

or link_to method.


Comments