Note: For linux users.
1) Open your terminal.
$ rails new appname
2)Go to application directory
$ cd appname
3)If you list the content(using ” $ ls ” ),you will seea number of autogenerated files and folders which makes a basic structure of rails.
4) Now check if your application is running correctly
$ rails s
(Open a browser window and navigate to http://localhost:3000. You should see the Rails default page)
5) Next we,have to create a controller(A controller’s purpose is to receive specific requests for the application).Here we create a controller with name “welcome” and action “index”.
$ rails generate controller welcome index
6)You will see a number of files along with a route automatically created.
7) To display some text on your application page,open
app/views/welcome/index.html.erb file in your text editor and type the text.For example,
8) Now that we have made the controller and view, we need to tell Rails when we want the text to show up(ie,fix routes for your homepage).
Open the file
config/routes.rb in your editor.Uncomment the line beginning with ‘root’.
9) Launch rails server and navigate to http://localhost:3000 in your browser. You’ll see the text you put into
app/views/welcome/index.html.erb , indicating that this new route is indeed going to
index action and is rendering the view correctly.