I am having some problems creating a route to my app, please help me :)
Can anyone explain to me why a two level route renders my root page, no matter if the route really exists or not.
Let me exemplify:
I have the route: match '/p/novo' => 'user_roles#new', :as => :new_urole
I expected the new method from the user_roles
method to be called, but it doesnt happen. Instead of it, my root page gets rendered and the log shows:
Started GET "/p/novo" for 127.0.0.1 at 2012-10-04 16:50:23 -0300 Processing by HomeController#index as HTML
If i remove the '/novo' from the route, everything works!
Can anyone help me?
Edit: I dont know why, but i placed the route above a route that linked to my root and it worked
My rake:routes
WORKING
/auth/:provider/callback(.:format) session#create
login_erro /login/erro(.:format) session#failure
logout /logout(.:format) session#destroy
new_urole /p/novo(.:format) user_roles#new
event /evento/:day/:month/:year/:url_name(.:format) events#show
/evento/:day/:month/:year/:url_name/confirmar_presenca(.:format) events#confirm_presence
painel_de_controle /painel_de_controle(.:format) users#control_panel
city_index /:state/:city(.:format) home#index
root / home#index
new_urole is not a GET route, it's likely a POST or PUT route. This is why it's not matching, your request is GET so it falls down all the way to the first GET route that matches, root.
You need to change your form :method to match your route method, POST or PUT.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.