Changing the default welcome page in rails

Well, consider you created the new application in rails (may be using netbeans or rubymine). Then used db:migrate ,bundle install etc to make your application in rails. Now the question is how to show your own page as the welcome page?

Now rails use MVC, so if you make welcome controller with index method, then it creates an index view which can be accessed by ,


now to make this page as your welcome page , go to route file (config/route.tb) and then write the following,

root :to => “welcome#index”

here welcome is the controller and index is the view. So in general , root:to =>controller#index

now go to public folder in root of your application and remove index.html

now your desired page will be the welcome page.

Point to note that, application.html.erb inside the views/layout folder is the first place that rendering starts, the word yelds in side this file leads to your desired view using your defined route (or REST, what ever!)

So you can consider the file views/layout/application.html.erb as your master page.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s