Rails 5 Basics : Running the Server
- To run your rails application on your machine and check your application's environment.
Check the versions of installed ruby, rails and ruby gems by running the following commands in the terminal:
The output on my machine is : ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
The output on my machine is: Rails 5.0.0.alpha
$rails c Loading development environment (Rails 5.0.0.alpha) a2.2.3 :001 > Rails.version => "5.0.0.alpha"
You can also check the version in the rails console.
The output on my machine is: RUBYGEMS VERSION: 188.8.131.52
Change directory to where you want to work on new projects.
Create a new Rails project called blog by running the following command.
$rails new blog
Open a terminal and change directory to the blog project.
Open the blog project in your favorite IDE. For Textmate :
Run the rails server:
Open a browser window and enter
http://localhost:3000. Welcome page is displayed as the home page.
You can shutdown your server by pressing Control+C.
Click on the 'About' link and check the versions of software installed. If the background of the about section is yellow, installation is fine. If it is red then something is wrong with the installation.
The rails generator automatically runs the Bundler command bundle to install your application dependencies by reading the Gemfile. The Gemfile contains all the gems that your application needs. rails s (s is a short-cut for server) runs your server on your machine on port 3000.
In this lesson you learned how to run the server locally. We also saw how to check if everything is installed properly on our machine. In the next lesson you will learn how to create a home page for your web application.