Customise your “Rails Project’s Home page”

Hai friends,

Today i learned from raji akka, How to customise our “Rails Project’s Home page”.

Rails comes with built-in support for SQLite3, choose to use MySQL instead of the shipped Sqlite3 database. Open tour terminal and follow the following commands. Here “universal” is our project name.


rails new universal -d mysql

Go to “universal” Directory


cd universal


Here, our config/database.yml will look a little different. If your development computer’s MySQL installation includes a root user with an empty password, this configuration should work for you. Otherwise, change the username and password in the development section as appropriate.


gedit config/database.yml


Foe Example, In app–>view, we are creating “world”  and “moon” name files. Here “world” folder have “moon.html.erb” file

rails generate controller world moon


Lets check the default home page.


rails s


Open the link and look the welcome page.(Welcome aboard)

Starting the server


Rails Default welcome page


Now, we have to remove default “index.html” file. Go to public folder and remove the  html file.


rm public/index.html


Now, we have to tell Rails where our actual home page is located. So, Next we have to go “config” folder and have to edit “routers.rb” file.


cd config


This file contains many sample routes on commented lines, and one of them actually shows you how to connect the root of your site to a specific controller and action. Find the line beginning with root :to uncomment it and change it like the following:


gedit routes.rb


routes.rb file


Have to change this


change into our "moon" index action

Now we are going to write a html program. Open the following file and erase the old program and we have to add our program.


gedit app/views/world/moon.html.erb

My Sample html program.

<body style="background-color:PowderBlue;">

<h1>Welcome to World And Moon </h1>

<p style="font-family:verdana;color:red">
This page designed in simple html code </p>

<p style="font-family:times;color:green">
Think Better! live Better!</p>

<p style="font-size:30px">You can also customise your's "Rails Project Home page"</p>



Now, we again start the rails server and open the localhost, Then see the new welcome page.


rails s


Again Start the server

Customized welcome page


That’s all !!! 

If you have any doubt, feel free to ask me




One thought on “Customise your “Rails Project’s Home 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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s