Skip to content
The main sample app for the Ruby on Rails Tutorial, 6th Edition
Ruby HTML CSS JavaScript
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
bin Initialize repository Aug 20, 2019
config Implement following/unfollowing interface Aug 27, 2019
db Implement following/unfollowing interface Aug 27, 2019
lib Initialize repository Aug 20, 2019
log Initialize repository Aug 20, 2019
public Initialize repository Aug 20, 2019
storage Initialize repository Aug 20, 2019
test Add a test to catch missing scope Oct 3, 2019
tmp Initialize repository Aug 20, 2019
vendor Initialize repository Aug 20, 2019
.browserslistrc
.gitignore Ignore db test files Sep 16, 2019
.ruby-version Initialize repository Aug 20, 2019
Gemfile Move aws gem Oct 20, 2019
Gemfile.lock Update gems Nov 2, 2019
Guardfile Create the Micropost model Aug 24, 2019
HELP.md Remove irc link Sep 4, 2019
LICENSE.md Add newlines Aug 25, 2019
Procfile Use SSL and the Puma webserver in production Aug 22, 2019
README.md Expand the README Aug 30, 2019
Rakefile Initialize repository Aug 20, 2019
babel.config.js Initialize repository Aug 20, 2019
config.ru Initialize repository Aug 20, 2019
package.json
postcss.config.js Initialize repository Aug 20, 2019
yarn.lock Get login working Aug 22, 2019

README.md

Ruby on Rails Tutorial sample application

Reference implementation

This is the reference implementation of the sample application from Ruby on Rails Tutorial: Learn Web Development with Rails (6th Edition) by Michael Hartl.

License

All source code in the Ruby on Rails Tutorial is available jointly under the MIT License and the Beerware License. See LICENSE.md for details.

Getting started

To get started with the app, first clone the repo and cd into the directory:

$ git clone https://github.com/mhartl/sample_app_6th_ed.git 
$ cd sample_app_6th_ed

Then install the needed gems (while skipping any gems needed only in production):

$ bundle install --without production

Next, migrate the database:

$ rails db:migrate

Finally, run the test suite to verify that everything is working correctly:

$ rails test

If the test suite passes, you'll be ready to run the app in a local server:

$ rails server

Branches

The reference app repository includes a separate branch for each chapter in the tutorial (Chapters 3–14). To examine the code as it appears at the end of a particular chapter, simply check out the corresponding branch using git checkout:

$ git checkout <branch name>

A full list of branch names appears as follows:

static-pages
rails-flavored-ruby
filling-in-layout
modeling-users
sign-up
basic-login
advanced-login
updating-users
account-activation
password-reset
user-microposts
following-users

Starting in Chapter 10 (“Updating users”), the sample app comes configured to seed the database with sample users, which you can activate by resetting the database and then running the seed program:

$ rails db:migrate:reset
$ rails db:seed

Help with the Rails Tutoiral

Experience shows that comparing code with the reference app is often helpful for debugging errors and tracking down discrepancies. For additional assistance with any issues in the tutorial, please consult the Rails Tutorial Help page.

Suspected errors, typos, and bugs can be emailed to admin@railstutorial.org. All such reports are gratefully received, but please double-check with the online version of the tutorial and this reference app before submitting.

You can’t perform that action at this time.