Search
Categories
Ad

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: ,

2 Responses to “root_url undefined”

  1. about2flip says:

    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”

  2. pete says:

    “mpa.root” typo?

Leave a Reply