suresh suresh - 3 months ago 8
Ruby Question

how to add the home page as a root in rails version 2.3.14?

I am new to the rails programming.

I had a one problem to building a first rails application in rails version 2.3.14.
The problem is , I am not able to add the root in the config/routes.rb file.

I was created the home and about pages. I am trying to add the home page as a root. For that I was added the below line in the routes.rb file.

root 'pages#home'


But it gives error. The error is,

undefined method `root' for main:Object (NoMethodError)


It says the root is a undefined method. So, What method is used to add the home page as a root in rails version 2.3.14.

Answer

Use map.root and start upgrading your app to newer version of Rails :)

map.root :controller => "pages", :action => "home"