---
title: "Discussion on \"undefined local variable or method `root_path' for #<XXXController> in Rails\" | Hashnode"
description: "Discussion on \"undefined local variable or method `root_path' for #<XXXController> in Rails\". TL; DR: If you specify a new name for a route, a new path is also going to be defined.\n\n\nProblem\nRails doesn't not redirect to root_path, even though there's a root route defined in the routes.rb file.\n\nError\nLet's check the error in several differen..."
url: "https://hashnode.com/posts/undefined-local-variable-or-method-rootpath-for-xxxcontroller-in-rails/64681879fc7bc84272889605"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [undefined local variable or method \`root\_path' for #<XXXController> in Rails](https://blog.alexandrecalaca.com/undefined-local-variable-or-method-rootpath-for-xxxcontroller-in-rails?utm_source=hashnode&utm_medium=feed)

TL; DR: If you specify a new name for a route, a new path is also going to be defined. Problem Rails doesn't not redirect to root\_path, even though there's a root route defined in the routes.rb file. Error Let's check the error in several differen...

May 20, 2023 · 4 min read · blog.alexandrecalaca.com  
Read the article

-   [#ruby](https://hashnode.com/tag/ruby)
-   [#ruby-on-rails](https://hashnode.com/tag/ruby-on-rails)
-   [#web-development](https://hashnode.com/tag/web-development)
-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)
-   [#2articles1week](https://hashnode.com/tag/2articles1week)

## Written by

[Alexandre Calaça](https://hashnode.com/@alexandrecalaca)

@alexandrecalaca

  
[View profile](https://hashnode.com/@alexandrecalaca)

I'm a passionate software developer.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
