Your First Pages

Premium Content - Free Preview

The Models and Data Tutorial showed you how to create the back-end of a web application; this tutorial will show you how to create a full site. You'll learn to create simple web pages and then learn how to connect web pages with data from the back-end. You'll see how to build the application represented in the physical machine below. To get started, you first need to run your website on the rails server.

Rails Server

A web server is a system that delivers web pages to users who request them. A server can refer to physical computers or to the software that handles these requests. You're unlikely to ever need to deal with physical servers, but you do need to run server software to make your web application work on the internet. Even if you just want to try out your web application on your own, you'll need to set up a server on your computer for that purpose.

Fortunately, Rails comes with a simple built-in library for running a web server. Enter the following command into your console to start the rails web server:

rails server

On cloud9, you'll need to modify the command as follows:

rails server -b $IP -p $PORT 

You should see the following output:
Hover below for more info

=> Booting WEBrick
=> Rails 4.2.0 application starting in development on  http://localhost:3000
=> Run 'rails server -h' for more startup options
=> Ctrl-C to shutdown server
[2015-04-14 16:10:10] INFO  WEBrick 1.3.1
[2015-04-14 16:10:10] INFO  ruby 2.0.0 (2014-02-24) [x86_64-darwin12.5.0]
[2015-04-14 16:10:10] INFO  WEBrick::HTTPServer#start: pid=18346 port=3000

Now that your server is running, navigate to your home page. On your computer, go to http://localhost:3000. On Cloud9, click on the link shown.

You should see the following page:

End of Free Content Preview. Please Sign in or Sign up to buy premium content.

Contact Us
Sign in or email us at [email protected]