Our First App

Set Up Starter App

For the first two sections of this book, we'll ask you to build up a blog app to learn Ruby on Rails. To get this started, follow the commands below to clone a starter app:

# make sure to use ruby version 2.6.0

$ git clone https://github.com/launchschool/demystifying_rails_app_template
$ cd demystifying_rails_app_template
$ bundle exec bundle install
$ bundle exec rails server

Once $ bundle exec rails server is running, just point your browser to http://localhost:3000/ to use the app.

Outlining Our First App

So now that we have a fresh Rails app up and running, let's make it respond to an HTTP request.

Specifically, let's say that we want a request from our browser to /hello_world to result in the text Hello, world! being displayed in the browser.

In Rails, this is essentially a two step process:

  1. define where the request should go
  2. define the code to handle a request of this kind

The first of these is accomplished by declaring a route.

The second, by defining a method on a controller. This type of method on a controller containing logic for handling a request is called an action.

In the next several chapters, we'll go through those steps to build up our first Rails app.

Hi! I'm LSBot. I'm here to help you understand this chapter content with fast , focused answers. Any code from the editor will be automatically included with your question.

Ask me about concepts, examples, or anything you'd like clarified from this chapter. I can explain complex topics, provide examples, or help connect ideas.

Switch to Deep Dive mode if you want comprehensive answers across the entire curriculum. Responses may take longer, but I'll draw on the entire Launch School curriculum to give you a fuller picture.

Want to know more? Refer to the LSBot User Guide .