Within a rails app I’ve got a special url (/profile) that I’m mapping
to the user controller to allow a user to view and edit their profile.
I made the following entries into my route file so that the “get” for
profile will route me to the profile action in the user controller and
the “post” for profile will route to the update_profile action in the
user controller.
match ‘/profile’, :to => ‘users#profile’, :via => “get”
match ‘/profile’, :to => ‘users#update_profile’, :via => “post”
If I run rake routes I see the following two entries
profile GET /profile(.:format) {:controller=>“users”,
":action=>“profile”}
profile POST /profile(.:format) {:controller=>“users”,
":action=>“update_profile”}
If I try hitting the dev url http://localhost:3000/profile it brings
up the profile page as expected. If I press the form button it gives
me the following error:
Routing Error
No route matches “/profile”
Looking at the generated html on the initial page I see the following
form tag, so it seems the action is correctly set.