Skip to content

Commit e11084c

Browse files
committed
Update the README
1 parent e3384d5 commit e11084c

File tree

1 file changed

+84
-7
lines changed

1 file changed

+84
-7
lines changed

README.md

Lines changed: 84 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,34 @@ is available jointly under the MIT License and the Beerware License. See
1313

1414
## Getting started
1515

16-
To get started with the app, clone the repo and then install the needed gems:
16+
To get started with the app, clone the repo and then install the needed gems. You can clone the repo as follows:
1717

1818
```
19-
$ gem install bundler -v 2.2.33
20-
$ bundle _2.2.33_ config set --local without 'production'
21-
$ bundle _2.2.33_ install
19+
$ git clone https://github.com/learnenough/rails_tutorial_sample_app_7th_ed
20+
$ cd rails_tutorial_sample_app_7th_ed/
21+
```
22+
23+
To install the gems, you will need the same version of Bundler used to build the sample app, which you can find using the `tail` command as follows:
24+
25+
```
26+
$ tail -n1 Gemfile.lock
27+
<version number>
28+
```
29+
30+
Next, install the same version of the `bundler` gem and install the gems accordingly:
31+
32+
```
33+
$ gem install bundler -v <version number>
34+
$ bundle _<version number>_ config set --local without 'production'
35+
$ bundle _<version number>_ install
36+
```
37+
38+
Here you should replace `<version number>` with the actual version number. For example, if `<version number>` is `2.3.10`, then the commands should look like this:
39+
40+
```
41+
$ gem install bundler -v 2.3.10
42+
$ bundle _2.3.10_ config set --local without 'production'
43+
$ bundle _2.3.10_ install
2244
```
2345

2446
Next, migrate the database:
@@ -33,11 +55,66 @@ Finally, run the test suite to verify that everything is working correctly:
3355
$ rails test
3456
```
3557

36-
If the test suite passes, you'll be ready to run the app in a local server:
58+
If the test suite passes, youll be ready to seed the database with sample users and run the app in a local server:
3759

3860
```
61+
$ rails db:seed
3962
$ rails server
4063
```
4164

42-
For more information, see the
43-
[*Ruby on Rails Tutorial* book](https://www.railstutorial.org/book).
65+
Follow the instructions in [Section 1.2.2 `rails server`](https://www.railstutorial.org/book#sec-rails_server) to view the app. You can then register a new user or log in as the sample administrative user with the email `[email protected]` and password `foobar`.
66+
67+
## Deploying
68+
69+
To deploy the sample app to production, you’ll need a Heroku account as discussed [Section 1.4 Deploying](https://www.railstutorial.org/book/beginning#sec-deploying).
70+
71+
The full production app includes several advanced features, including sending email with [SendGrid](https://sendgrid.com/) and storing uploaded images with [AWS S3](https://aws.amazon.com/s3/). As a result, deploying the full sample app can be rather challenging. The suggested method for testing a deployment is to use the branch for Chapter 10 (“Updating users”), which doesn’t require more advanced settings but still includes sample users.
72+
73+
To deploy this version of the app, you’ll need to create a new Heroku application, switch to the right branch, push up the source, run the migrations, and seed the database with sample users:
74+
75+
```
76+
$ heroku create
77+
$ git checkout updating-users
78+
$ git push heroku updating-users:main
79+
$ heroku run rails db:migrate
80+
$ heroku run rails db:seed
81+
```
82+
83+
Visiting the URL returned by the original `heroku create` should now show you the sample app running in production. As with the local version, you can then register a new user or log in as the sample administrative user with the email `[email protected]` and password `foobar`.
84+
85+
## Branches
86+
87+
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 (with some slight variations, such as occasional exercise answers), simply check out the corresponding branch using `git checkout`:
88+
89+
```
90+
$ git checkout <branch name>
91+
```
92+
93+
A full list of branch names appears as follows (preceded the number of the corresponding chapter in the book):
94+
95+
```
96+
3. static-pages
97+
4. rails-flavored-ruby
98+
5. filling-in-layout
99+
6. modeling-users
100+
7. sign-up
101+
8. basic-login
102+
9. advanced-login
103+
10. updating-users
104+
11. account-activation
105+
12. password-reset
106+
13. user-microposts
107+
14. following-users
108+
```
109+
110+
For example, to check out the branch for Chapter 7, you would run this at the command line:
111+
112+
```
113+
$ git checkout sign-up
114+
```
115+
116+
## Help with the Rails Tutoiral
117+
118+
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](https://www.railstutorial.org/help).
119+
120+
Suspected errors, typos, and bugs can be emailed to <[email protected]>. All such reports are gratefully received, but please double-check with the [online version of the tutorial](https://www.railstutorial.org/book) and this reference app before submitting.

0 commit comments

Comments
 (0)