root_url undefined
Problem
On Ruby on Rails, you see the NameError of “undefined local variable or method `root_url’ for #<YourController>”.
Solution
You need to set map.root in config/routes.rb, such as
mpa.root :controller => :welcome
Tags: rails, ruby
This entry was posted
on Friday, August 7th, 2009 at 3:18 am and is filed under TechTips.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Hi:
I tried this and it did not take me back to the page I originally came from.
For ex:
I am learning to use authlogic, and I am at controller called animals. So I click register link on that page, and registered successfully, but it did not go back to that page I came from. Instead I got the error:
undefined local variable or method `root_url’
so I changed my root url to controller animal, and it took me back to my welcome page, instead of the page I needed to see my flash notice “Registration Succesful”
“mpa.root” typo?