Form method="post/get" and routes

Hello there, I'm doing a form and I want to send this form with method="post". Head of form looks so:

<%= form_tag({ :controller => 'admin', :action => 'menu_add' }, { :method => 'post' }) do %>

And in controller I have this:

  def menu_add     menu_new = Menu.new(...)     ...   end

And with I am fighting - I'm not using type of route get 'admin/menu_add' - I'm sending a form by method post -- but I am still getting the route error "Unknown action - The action 'menu_add' could not be found for AdminController" -- how it is possible, if I'm not using route 'admin/menu_add' by get, but by post?

And one question yet - exist some effective way, how to work with routes? If i want to add some new action, I must to add to file 'routes.rb' line as:

get 'admin/menu_add' post 'admin/menu_add'

It's a bit boring to add every new action so manually... is some better way, how to do?

Thanks a lot, Manny.

I’m not sure which version of Rails you are using so I’ve provided a link to a tutorial for both. I think if you read/watch them it will help to clear up a lot of the issues you are having.

Rails 2 routes http://darynholmes.wordpress.com/2008/03/15/beginners-tutorial-routing-in-rails-20-with-rest-part-1-of-n/

Rails 3 routes http://railscasts.com/episodes/203-routing-in-rails-3

Good luck.

B.