I have a model Product that is both used by a general controller products_controller and another one used for administration purposes products_controller in an /admin folder.
Because I wanted to create a form that will be sent via AJAX and depending on whether the product is there or not it will alter between a :create and an :update, I’ve decided to create a 3rd method that takes care of that; called insert.
def insert
#blah
end
The form tag I’m using for updating is:
<%= form_for(product, :url => admin_product_url(product), :remote => true, :layout => true) do |f| %>
So my question is how can I customize the form tag in order to call the insert action I tried:
<%= form_for(product, :url => admin_product_url(product), :action => :insert, :remote => true, :layout => true) do |f| %>
and
<%= form_for(product, :url => insert_admin_product_url(product), :remote => true, :layout => true) do |f| %>
so far with no luck.
I hope someone could show me the way to go.
Thanks
you should have to add below route in route file under the admin name space