Learning ROR: Part 4 – Creating the First Rails Project

Rails, Ruby, Ruby on Rails, Tutorial Voice your views  

Now that you have installed Sublime Text 2 Editor, Ruby, Rails, its time to do our first rails program. Before getting started, if you have not worked out any of the above said tasks, do refer to the following blog posts,

1. Installing Ruby on Rails

2. Basic Rails Commands

3. Installing Sublime Text 2 Editor

Let’s get Started with our first app!

Step 1: Create a New Directory names “Sample_RailsApp” and switch into the directory

$ mkdir Sample_RailsApp
$ cd Sample_RailsApp
$ rails new hello_world
      create  
      create  README.rdoc
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/images/rails.png
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/mailers
      create  app/models
      create  app/views/layouts/application.html.erb
      create  app/mailers/.gitkeep
      create  app/models/.gitkeep
      create  config
      .
      .
      .
      create  vendor/plugins
      create  vendor/plugins/.gitkeep
         run  bundle install
Fetching source index for https://rubygems.org/
.
.
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled
gem is installed.

In the above step,” rails new” Command creates the various directories (Folder Structure) for our new rails application and runs bundle install command where it installs all gems necessary for the rails app.

Step 2: Once the new Project is generated, change directory into the project directory and run the “rails server” command to launch the WeBrick server.

$ cd hello_world
$ rails server
=> Booting WEBrick
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server

On executing the above command, you can open your browser with the URL: http://localhost:3000 (or) http://0.0.0.0:3000 to view the Rails Welcome Page. We will replace this default Page with our custom designed HTML Home Page in our upcoming tutorials.

Congrats! You have created (Generated) your first rails Application and have setup the server. Now in the upcoming posts, I’ll we will look more in-depth explanations on how Rails Work.

Add a Comment

%d bloggers like this: