How to Run a Ruby on Rails Application
Step through how to run the Rails server and run a Rails application.
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
Video locked
This video is viewable to users with a Bottega Bootcamp license

Before running a Ruby on Rails application, check if your postgresql database is running in the background. If you're using the existing SQLite database, then you don't have to do anything.

As a first step, we have to create our database and the schema file, and to do this, we have to run two commands in our terminal.

rake db:create:all

This command will create our database.

rake db:migrate

This command will create our schema file.

To start Rails, type rails s *this is short for rails server which would also work

This command will start the Rails application, and will look like this.

large

What this means is that the system is booting WEBrick, a server. Though we use this server in the development environment for now, it's very slow. I will show you later how to change the server to run more complex applications.

The next line the the version of Rails that we're using and the URL for this application, which is http://localhost:3000

The third line tells you to type rails server -h, if you need any help with startup options. You will not have much use for these startup options, except "-p" when you want to change the port.

The next line tells you how to shut down the server, while the following three lines show you that the application has started and is working fine.

Check on the Browser

If you want to see it on the browser, type localhost:3000, and this will bring up the default Ruby on Rails screen. It also means your application is working as it should.

large