0% found this document useful (0 votes)
6 views

Ruby on Rails Tutorial Learn Web Development with Rails 3rd Edition Michael Hartl instant download

The document is a promotional text for the 'Ruby on Rails Tutorial: Learn Web Development with Rails, 3rd Edition' by Michael Hartl, available for download in PDF format. It includes links to additional recommended Ruby on Rails resources and books. The tutorial covers various aspects of web development using Ruby on Rails, including setting up a development environment, creating applications, and deploying them.

Uploaded by

ouphmwemy7329
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Ruby on Rails Tutorial Learn Web Development with Rails 3rd Edition Michael Hartl instant download

The document is a promotional text for the 'Ruby on Rails Tutorial: Learn Web Development with Rails, 3rd Edition' by Michael Hartl, available for download in PDF format. It includes links to additional recommended Ruby on Rails resources and books. The tutorial covers various aspects of web development using Ruby on Rails, including setting up a development environment, creating applications, and deploying them.

Uploaded by

ouphmwemy7329
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

Ruby on Rails Tutorial Learn Web Development with

Rails 3rd Edition Michael Hartl download pdf

https://ebookultra.com/download/ruby-on-rails-tutorial-learn-web-
development-with-rails-3rd-edition-michael-hartl/

Visit ebookultra.com today to download the complete set of


ebook or textbook!
Here are some recommended products for you. Click the link to
download, or explore more at ebookultra.com

Agile Web Development with Rails 5 1st Edition Sam Ruby

https://ebookultra.com/download/agile-web-development-with-
rails-5-1st-edition-sam-ruby/

RailsSpace Building a Social Networking Website with Ruby


on Rails Addison Wesley Professional Ruby Series Hartl

https://ebookultra.com/download/railsspace-building-a-social-
networking-website-with-ruby-on-rails-addison-wesley-professional-
ruby-series-hartl/

Agile Web Development with Rails 4th edition Beta 10


version Sam Ruby

https://ebookultra.com/download/agile-web-development-with-rails-4th-
edition-beta-10-version-sam-ruby/

Practical JRuby on Rails Web 2 0 projects bringing Ruby on


Rails to the Java platform 1st Edition Ola Bini

https://ebookultra.com/download/practical-jruby-on-rails-
web-2-0-projects-bringing-ruby-on-rails-to-the-java-platform-1st-
edition-ola-bini/
Build Your Own Ruby on Rails Web Applications 1st Edition
Patrick Lenz

https://ebookultra.com/download/build-your-own-ruby-on-rails-web-
applications-1st-edition-patrick-lenz/

Ruby on Rails For Dummies 1st Edition Burd

https://ebookultra.com/download/ruby-on-rails-for-dummies-1st-edition-
burd/

Ruby on Rails Background Jobs with Sidekiq 1 / converted


Edition David B. Copeland

https://ebookultra.com/download/ruby-on-rails-background-jobs-with-
sidekiq-1-converted-edition-david-b-copeland/

Practical Reporting with Ruby and Rails 1st Edition David


Berube

https://ebookultra.com/download/practical-reporting-with-ruby-and-
rails-1st-edition-david-berube/

Pro Active Record Databases with Ruby and Rails 1st


Edition Kevin Marshall

https://ebookultra.com/download/pro-active-record-databases-with-ruby-
and-rails-1st-edition-kevin-marshall/
Ruby on Rails Tutorial Learn Web Development with
Rails 3rd Edition Michael Hartl Digital Instant Download
Author(s): Michael Hartl
ISBN(s): 9780134077703, 0134077709
Edition: 3
File Details: PDF, 15.25 MB
Year: 2015
Language: english
COVERSRAI
LS4.
2

THE
RUBYON RAI
LS
TUTORI
AL
LEARN WEBDEVELOPMENTWI
TH RAI
LS
THI
RD EDI
TION

BOOKAND SCREENCASTSBY
MI
CHAELHARTL
2
Ruby on Rails Tutorial
Learn Web Development with Rails

Michael Hartl
ii
Contents

1 From zero to deploy 1


1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.1 Prerequisites . . . . . . . . . . . . . . . . . . . . . . 5
1.1.2 Conventions in this book . . . . . . . . . . . . . . . . 7
1.2 Up and running . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.2.1 Development environment . . . . . . . . . . . . . . . 10
1.2.2 Installing Rails . . . . . . . . . . . . . . . . . . . . . 12
1.3 The first application . . . . . . . . . . . . . . . . . . . . . . . 15
1.3.1 Bundler . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.3.2 rails server . . . . . . . . . . . . . . . . . . . . 24
1.3.3 Model-View-Controller (MVC) . . . . . . . . . . . . 25
1.3.4 Hello, world! . . . . . . . . . . . . . . . . . . . . . . 31
1.4 Version control with Git . . . . . . . . . . . . . . . . . . . . . 34
1.4.1 Installation and setup . . . . . . . . . . . . . . . . . . 36
1.4.2 What good does Git do you? . . . . . . . . . . . . . . 39
1.4.3 Bitbucket . . . . . . . . . . . . . . . . . . . . . . . . 40
1.4.4 Branch, edit, commit, merge . . . . . . . . . . . . . . 44
1.5 Deploying . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
1.5.1 Heroku setup . . . . . . . . . . . . . . . . . . . . . . 51
1.5.2 Heroku deployment, step one . . . . . . . . . . . . . 54
1.5.3 Heroku deployment, step two . . . . . . . . . . . . . 54
1.5.4 Heroku commands . . . . . . . . . . . . . . . . . . . 54
1.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
1.6.1 What we learned in this chapter . . . . . . . . . . . . 57

iii
iv CONTENTS

1.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

2 A toy app 61
2.1 Planning the application . . . . . . . . . . . . . . . . . . . . 62
2.1.1 A toy model for users . . . . . . . . . . . . . . . . . . 65
2.1.2 A toy model for microposts . . . . . . . . . . . . . . 65
2.2 The Users resource . . . . . . . . . . . . . . . . . . . . . . . 66
2.2.1 A user tour . . . . . . . . . . . . . . . . . . . . . . . 69
2.2.2 MVC in action . . . . . . . . . . . . . . . . . . . . . 76
2.2.3 Weaknesses of this Users resource . . . . . . . . . . . 84
2.3 The Microposts resource . . . . . . . . . . . . . . . . . . . . 84
2.3.1 A micropost microtour . . . . . . . . . . . . . . . . . 85
2.3.2 Putting the micro in microposts . . . . . . . . . . . . 90
2.3.3 A user has_many microposts . . . . . . . . . . . . . 90
2.3.4 Inheritance hierarchies . . . . . . . . . . . . . . . . . 93
2.3.5 Deploying the toy app . . . . . . . . . . . . . . . . . 96
2.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
2.4.1 What we learned in this chapter . . . . . . . . . . . . 99
2.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

3 Mostly static pages 103


3.1 Sample app setup . . . . . . . . . . . . . . . . . . . . . . . . 104
3.2 Static pages . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
3.2.1 Generated static pages . . . . . . . . . . . . . . . . . 108
3.2.2 Custom static pages . . . . . . . . . . . . . . . . . . 118
3.3 Getting started with testing . . . . . . . . . . . . . . . . . . . 121
3.3.1 Our first test . . . . . . . . . . . . . . . . . . . . . . 123
3.3.2 Red . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
3.3.3 Green . . . . . . . . . . . . . . . . . . . . . . . . . . 126
3.3.4 Refactor . . . . . . . . . . . . . . . . . . . . . . . . . 130
3.4 Slightly dynamic pages . . . . . . . . . . . . . . . . . . . . . 130
3.4.1 Testing titles (Red) . . . . . . . . . . . . . . . . . . . 131
3.4.2 Adding page titles (Green) . . . . . . . . . . . . . . . 133
3.4.3 Layouts and embedded Ruby (Refactor) . . . . . . . . 136
CONTENTS v

3.4.4 Setting the root route . . . . . . . . . . . . . . . . . . 142


3.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
3.5.1 What we learned in this chapter . . . . . . . . . . . . 145
3.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
3.7 Advanced testing setup . . . . . . . . . . . . . . . . . . . . . 148
3.7.1 MiniTest reporters . . . . . . . . . . . . . . . . . . . 149
3.7.2 Backtrace silencer . . . . . . . . . . . . . . . . . . . 150
3.7.3 Automated tests with Guard . . . . . . . . . . . . . . 150

4 Rails-flavored Ruby 159


4.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
4.2 Strings and methods . . . . . . . . . . . . . . . . . . . . . . . 164
4.2.1 Comments . . . . . . . . . . . . . . . . . . . . . . . 165
4.2.2 Strings . . . . . . . . . . . . . . . . . . . . . . . . . 166
4.2.3 Objects and message passing . . . . . . . . . . . . . . 169
4.2.4 Method definitions . . . . . . . . . . . . . . . . . . . 172
4.2.5 Back to the title helper . . . . . . . . . . . . . . . . . 174
4.3 Other data structures . . . . . . . . . . . . . . . . . . . . . . 175
4.3.1 Arrays and ranges . . . . . . . . . . . . . . . . . . . 175
4.3.2 Blocks . . . . . . . . . . . . . . . . . . . . . . . . . 179
4.3.3 Hashes and symbols . . . . . . . . . . . . . . . . . . 182
4.3.4 CSS revisited . . . . . . . . . . . . . . . . . . . . . . 187
4.4 Ruby classes . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
4.4.1 Constructors . . . . . . . . . . . . . . . . . . . . . . 189
4.4.2 Class inheritance . . . . . . . . . . . . . . . . . . . . 191
4.4.3 Modifying built-in classes . . . . . . . . . . . . . . . 195
4.4.4 A controller class . . . . . . . . . . . . . . . . . . . . 196
4.4.5 A user class . . . . . . . . . . . . . . . . . . . . . . . 197
4.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
4.5.1 What we learned in this chapter . . . . . . . . . . . . 202
4.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202

5 Filling in the layout 205


5.1 Adding some structure . . . . . . . . . . . . . . . . . . . . . 206
vi CONTENTS

5.1.1 Site navigation . . . . . . . . . . . . . . . . . . . . . 206


5.1.2 Bootstrap and custom CSS . . . . . . . . . . . . . . . 215
5.1.3 Partials . . . . . . . . . . . . . . . . . . . . . . . . . 222
5.2 Sass and the asset pipeline . . . . . . . . . . . . . . . . . . . 227
5.2.1 The asset pipeline . . . . . . . . . . . . . . . . . . . . 229
5.2.2 Syntactically awesome stylesheets . . . . . . . . . . . 232
5.3 Layout links . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
5.3.1 Contact page . . . . . . . . . . . . . . . . . . . . . . 240
5.3.2 Rails routes . . . . . . . . . . . . . . . . . . . . . . . 242
5.3.3 Using named routes . . . . . . . . . . . . . . . . . . . 244
5.3.4 Layout link tests . . . . . . . . . . . . . . . . . . . . 247
5.4 User signup: A first step . . . . . . . . . . . . . . . . . . . . 250
5.4.1 Users controller . . . . . . . . . . . . . . . . . . . . . 250
5.4.2 Signup URL . . . . . . . . . . . . . . . . . . . . . . 251
5.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
5.5.1 What we learned in this chapter . . . . . . . . . . . . 254
5.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256

6 Modeling users 259


6.1 User model . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
6.1.1 Database migrations . . . . . . . . . . . . . . . . . . 262
6.1.2 The model file . . . . . . . . . . . . . . . . . . . . . 269
6.1.3 Creating user objects . . . . . . . . . . . . . . . . . . 269
6.1.4 Finding user objects . . . . . . . . . . . . . . . . . . 273
6.1.5 Updating user objects . . . . . . . . . . . . . . . . . . 275
6.2 User validations . . . . . . . . . . . . . . . . . . . . . . . . . 276
6.2.1 A validity test . . . . . . . . . . . . . . . . . . . . . . 277
6.2.2 Validating presence . . . . . . . . . . . . . . . . . . . 278
6.2.3 Length validation . . . . . . . . . . . . . . . . . . . . 282
6.2.4 Format validation . . . . . . . . . . . . . . . . . . . . 284
6.2.5 Uniqueness validation . . . . . . . . . . . . . . . . . 290
6.3 Adding a secure password . . . . . . . . . . . . . . . . . . . 298
6.3.1 A hashed password . . . . . . . . . . . . . . . . . . . 298
6.3.2 User has secure password . . . . . . . . . . . . . . . 301
CONTENTS vii

6.3.3 Minimum password length . . . . . . . . . . . . . . . 303


6.3.4 Creating and authenticating a user . . . . . . . . . . . 304
6.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
6.4.1 What we learned in this chapter . . . . . . . . . . . . 309
6.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309

7 Sign up 313
7.1 Showing users . . . . . . . . . . . . . . . . . . . . . . . . . . 313
7.1.1 Debug and Rails environments . . . . . . . . . . . . . 314
7.1.2 A Users resource . . . . . . . . . . . . . . . . . . . . 320
7.1.3 Debugger . . . . . . . . . . . . . . . . . . . . . . . . 326
7.1.4 A Gravatar image and a sidebar . . . . . . . . . . . . 329
7.2 Signup form . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
7.2.1 Using form_for . . . . . . . . . . . . . . . . . . . 338
7.2.2 Signup form HTML . . . . . . . . . . . . . . . . . . 341
7.3 Unsuccessful signups . . . . . . . . . . . . . . . . . . . . . . 345
7.3.1 A working form . . . . . . . . . . . . . . . . . . . . . 345
7.3.2 Strong parameters . . . . . . . . . . . . . . . . . . . 351
7.3.3 Signup error messages . . . . . . . . . . . . . . . . . 353
7.3.4 A test for invalid submission . . . . . . . . . . . . . . 359
7.4 Successful signups . . . . . . . . . . . . . . . . . . . . . . . 362
7.4.1 The finished signup form . . . . . . . . . . . . . . . . 362
7.4.2 The flash . . . . . . . . . . . . . . . . . . . . . . . . 366
7.4.3 The first signup . . . . . . . . . . . . . . . . . . . . . 369
7.4.4 A test for valid submission . . . . . . . . . . . . . . . 372
7.5 Professional-grade deployment . . . . . . . . . . . . . . . . . 373
7.5.1 SSL in production . . . . . . . . . . . . . . . . . . . 374
7.5.2 Production webserver . . . . . . . . . . . . . . . . . . 375
7.5.3 Ruby version number . . . . . . . . . . . . . . . . . . 377
7.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
7.6.1 What we learned in this chapter . . . . . . . . . . . . 379
7.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
viii CONTENTS

8 Log in, log out 385


8.1 Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
8.1.1 Sessions controller . . . . . . . . . . . . . . . . . . . 387
8.1.2 Login form . . . . . . . . . . . . . . . . . . . . . . . 389
8.1.3 Finding and authenticating a user . . . . . . . . . . . 394
8.1.4 Rendering with a flash message . . . . . . . . . . . . 398
8.1.5 A flash test . . . . . . . . . . . . . . . . . . . . . . . 401
8.2 Logging in . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
8.2.1 The log_in method . . . . . . . . . . . . . . . . . . 404
8.2.2 Current user . . . . . . . . . . . . . . . . . . . . . . . 406
8.2.3 Changing the layout links . . . . . . . . . . . . . . . 411
8.2.4 Testing layout changes . . . . . . . . . . . . . . . . . 417
8.2.5 Login upon signup . . . . . . . . . . . . . . . . . . . 421
8.3 Logging out . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
8.4 Remember me . . . . . . . . . . . . . . . . . . . . . . . . . . 427
8.4.1 Remember token and digest . . . . . . . . . . . . . . 427
8.4.2 Login with remembering . . . . . . . . . . . . . . . . 433
8.4.3 Forgetting users . . . . . . . . . . . . . . . . . . . . . 442
8.4.4 Two subtle bugs . . . . . . . . . . . . . . . . . . . . 444
8.4.5 “Remember me” checkbox . . . . . . . . . . . . . . . 449
8.4.6 Remember tests . . . . . . . . . . . . . . . . . . . . . 456
8.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 464
8.5.1 What we learned in this chapter . . . . . . . . . . . . 465
8.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466

9 Updating, showing, and deleting users 471


9.1 Updating users . . . . . . . . . . . . . . . . . . . . . . . . . 471
9.1.1 Edit form . . . . . . . . . . . . . . . . . . . . . . . . 472
9.1.2 Unsuccessful edits . . . . . . . . . . . . . . . . . . . 478
9.1.3 Testing unsuccessful edits . . . . . . . . . . . . . . . 479
9.1.4 Successful edits (with TDD) . . . . . . . . . . . . . . 482
9.2 Authorization . . . . . . . . . . . . . . . . . . . . . . . . . . 485
9.2.1 Requiring logged-in users . . . . . . . . . . . . . . . 488
9.2.2 Requiring the right user . . . . . . . . . . . . . . . . 493
CONTENTS ix

9.2.3 Friendly forwarding . . . . . . . . . . . . . . . . . . 498


9.3 Showing all users . . . . . . . . . . . . . . . . . . . . . . . . 503
9.3.1 Users index . . . . . . . . . . . . . . . . . . . . . . . 503
9.3.2 Sample users . . . . . . . . . . . . . . . . . . . . . . 509
9.3.3 Pagination . . . . . . . . . . . . . . . . . . . . . . . 510
9.3.4 Users index test . . . . . . . . . . . . . . . . . . . . . 514
9.3.5 Partial refactoring . . . . . . . . . . . . . . . . . . . . 518
9.4 Deleting users . . . . . . . . . . . . . . . . . . . . . . . . . . 520
9.4.1 Administrative users . . . . . . . . . . . . . . . . . . 520
9.4.2 The destroy action . . . . . . . . . . . . . . . . . . 525
9.4.3 User destroy tests . . . . . . . . . . . . . . . . . . . . 528
9.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 531
9.5.1 What we learned in this chapter . . . . . . . . . . . . 532
9.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534

10 Account activation and password reset 537


10.1 Account activation . . . . . . . . . . . . . . . . . . . . . . . 538
10.1.1 Account activations resource . . . . . . . . . . . . . . 539
10.1.2 Account activation mailer method . . . . . . . . . . . 546
10.1.3 Activating the account . . . . . . . . . . . . . . . . . 560
10.1.4 Activation test and refactoring . . . . . . . . . . . . . 570
10.2 Password reset . . . . . . . . . . . . . . . . . . . . . . . . . . 576
10.2.1 Password resets resource . . . . . . . . . . . . . . . . 580
10.2.2 Password resets controller and form . . . . . . . . . . 584
10.2.3 Password reset mailer method . . . . . . . . . . . . . 590
10.2.4 Resetting the password . . . . . . . . . . . . . . . . . 597
10.2.5 Password reset test . . . . . . . . . . . . . . . . . . . 603
10.3 Email in production . . . . . . . . . . . . . . . . . . . . . . . 608
10.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 610
10.4.1 What we learned in this chapter . . . . . . . . . . . . 612
10.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
10.6 Proof of expiration comparison . . . . . . . . . . . . . . . . . 615
x CONTENTS

11 User microposts 617


11.1 A Micropost model . . . . . . . . . . . . . . . . . . . . . . . 617
11.1.1 The basic model . . . . . . . . . . . . . . . . . . . . 618
11.1.2 Micropost validations . . . . . . . . . . . . . . . . . . 620
11.1.3 User/Micropost associations . . . . . . . . . . . . . . 623
11.1.4 Micropost refinements . . . . . . . . . . . . . . . . . 627
11.2 Showing microposts . . . . . . . . . . . . . . . . . . . . . . . 632
11.2.1 Rendering microposts . . . . . . . . . . . . . . . . . 633
11.2.2 Sample microposts . . . . . . . . . . . . . . . . . . . 637
11.2.3 Profile micropost tests . . . . . . . . . . . . . . . . . 642
11.3 Manipulating microposts . . . . . . . . . . . . . . . . . . . . 649
11.3.1 Micropost access control . . . . . . . . . . . . . . . . 650
11.3.2 Creating microposts . . . . . . . . . . . . . . . . . . 652
11.3.3 A proto-feed . . . . . . . . . . . . . . . . . . . . . . 660
11.3.4 Destroying microposts . . . . . . . . . . . . . . . . . 669
11.3.5 Micropost tests . . . . . . . . . . . . . . . . . . . . . 672
11.4 Micropost images . . . . . . . . . . . . . . . . . . . . . . . . 676
11.4.1 Basic image upload . . . . . . . . . . . . . . . . . . . 677
11.4.2 Image validation . . . . . . . . . . . . . . . . . . . . 683
11.4.3 Image resizing . . . . . . . . . . . . . . . . . . . . . 686
11.4.4 Image upload in production . . . . . . . . . . . . . . 688
11.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 692
11.5.1 What we learned in this chapter . . . . . . . . . . . . 694
11.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695

12 Following users 701


12.1 The Relationship model . . . . . . . . . . . . . . . . . . . . . 702
12.1.1 A problem with the data model (and a solution) . . . . 702
12.1.2 User/relationship associations . . . . . . . . . . . . . 711
12.1.3 Relationship validations . . . . . . . . . . . . . . . . 713
12.1.4 Followed users . . . . . . . . . . . . . . . . . . . . . 715
12.1.5 Followers . . . . . . . . . . . . . . . . . . . . . . . . 719
12.2 A web interface for following users . . . . . . . . . . . . . . 721
12.2.1 Sample following data . . . . . . . . . . . . . . . . . 721
CONTENTS xi

12.2.2 Stats and a follow form . . . . . . . . . . . . . . . . . 723


12.2.3 Following and followers pages . . . . . . . . . . . . . 734
12.2.4 A working follow button the standard way . . . . . . . 744
12.2.5 A working follow button with Ajax . . . . . . . . . . 746
12.2.6 Following tests . . . . . . . . . . . . . . . . . . . . . 753
12.3 The status feed . . . . . . . . . . . . . . . . . . . . . . . . . 755
12.3.1 Motivation and strategy . . . . . . . . . . . . . . . . . 756
12.3.2 A first feed implementation . . . . . . . . . . . . . . 758
12.3.3 Subselects . . . . . . . . . . . . . . . . . . . . . . . . 762
12.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . 768
12.4.1 Guide to further resources . . . . . . . . . . . . . . . 768
12.4.2 What we learned in this chapter . . . . . . . . . . . . 769
12.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 770
xii CONTENTS
Foreword
My former company (CD Baby) was one of the first to loudly switch to Ruby
on Rails, and then even more loudly switch back to PHP (Google me to read
about the drama). This book by Michael Hartl came so highly recommended
that I had to try it, and the Ruby on Rails Tutorial is what I used to switch back
to Rails again.
Though I’ve worked my way through many Rails books, this is the one that
finally made me “get” it. Everything is done very much “the Rails way”—a
way that felt very unnatural to me before, but now after doing this book finally
feels natural. This is also the only Rails book that does test-driven development
the entire time, an approach highly recommended by the experts but which has
never been so clearly demonstrated before. Finally, by including Git, GitHub,
and Heroku in the demo examples, the author really gives you a feel for what
it’s like to do a real-world project. The tutorial’s code examples are not in
isolation.
The linear narrative is such a great format. Personally, I powered through
the Rails Tutorial in three long days,1 doing all the examples and challenges at
the end of each chapter. Do it from start to finish, without jumping around, and
you’ll get the ultimate benefit.
Enjoy!
Derek Sivers (sivers.org)
Founder, CD Baby

1
This is not typical! Getting through the entire book usually takes much longer than three days.

xiii
xiv CONTENTS
Acknowledgments
The Ruby on Rails Tutorial owes a lot to my previous Rails book, RailsSpace,
and hence to my coauthor Aurelius Prochazka. I’d like to thank Aure both
for the work he did on that book and for his support of this one. I’d also like
to thank Debra Williams Cauley, my editor on both RailsSpace and the Ruby
on Rails Tutorial; as long as she keeps taking me to baseball games, I’ll keep
writing books for her.
I’d like to acknowledge a long list of Rubyists who have taught and in-
spired me over the years: David Heinemeier Hansson, Yehuda Katz, Carl
Lerche, Jeremy Kemper, Xavier Noria, Ryan Bates, Geoffrey Grosenbach, Pe-
ter Cooper, Matt Aimonetti, Mark Bates, Gregg Pollack, Wayne E. Seguin,
Amy Hoy, Dave Chelimsky, Pat Maddox, Tom Preston-Werner, Chris Wan-
strath, Chad Fowler, Josh Susser, Obie Fernandez, Ian McFarland, Steven Bris-
tol, Pratik Naik, Sarah Mei, Sarah Allen, Wolfram Arnold, Alex Chaffee, Giles
Bowkett, Evan Dorn, Long Nguyen, James Lindenbaum, Adam Wiggins,
Tikhon Bernstam, Ron Evans, Wyatt Greene, Miles Forrest, the good people
at Pivotal Labs, the Heroku gang, the thoughtbot guys, and the GitHub crew.
Finally, many, many readers—far too many to list—have contributed a huge
number of bug reports and suggestions during the writing of this book, and I
gratefully acknowledge their help in making it as good as it can be.

xv
xvi CONTENTS
About the author
Michael Hartl is the author of the Ruby on Rails Tutorial, one of the lead-
ing introductions to web development, and is a cofounder of the Softcover
self-publishing platform. His prior experience includes writing and developing
RailsSpace, an extremely obsolete Rails tutorial book, and developing Insoshi,
a once-popular and now-obsolete social networking platform in Ruby on Rails.
In 2011, Michael received a Ruby Hero Award for his contributions to the Ruby
community. He is a graduate of Harvard College, has a Ph.D. in Physics from
Caltech, and is an alumnus of the Y Combinator entrepreneur program.

xvii
xviii CONTENTS
Random documents with unrelated
content Scribd suggests to you:
left in shame and silence. The Governor did not expose Tiemann, in
consequence of his innocent and interesting family, and his aged
father, and his numerous relatives, including the versatile Peter
Cooper, whose adopted daughter Mayor Tiemann married. These
revelations will cause the worthy citizens of New York to bend their
heads in sorrow, to behold a man of Mayor Tiemann’s exalted
professions of purity and piety, guilty of crimes that should consign
him to the rack, and to an eternal hell.
Advertisements—25 Cents a line.

Credit—From two to four seconds, or as long as the Advertiser can


hold his breath! Letters and Advertisements to be left at No. 128
Nassau street, third floor, back room.

N OTICE TO FARMERS AND MARKET GARDENERS.—City Inspector’s


Department, New York, June 16, 1858.—In conformity with the
following resolution, the space therein mentioned will be permitted
to be used as a place, by farmers and gardeners, for the sale of
vegetables and garden produce, until the hour of 12 o’clock, M.,
daily—the use to be free of charge:
Resolved, That permission be, and is hereby, given to farmers and
market gardeners, to occupy daily, until 12 M., free of charge, the
vacant space of the northern and southern extremities of the
intersection of Broadway and Sixth avenue, between Thirty-second
and Thirty-fifth streets, without infringing upon the streets which the
said space intersects, for the purpose only of selling vegetables and
market produce, of their own farms or gardens, under the
supervision of the City Inspector.
Also, by resolution of the Common Council, The use of Gouverneur
slip is granted to farmers and gardeners for the sale of produce from
wagons.
GEO W. MORTON, City Inspector.
JOSEPH CANNING, Sup’t of Markets.

N
N OTICE—TO PERSONS KEEPING SWINE, OWNERS OF PROPERTY
WHERE THE SAME MAY BE KEPT, AND ALL OTHERS
INTERESTED. At a meeting of the Mayor and Commissioners of
Health, held at the City Hall of the City of New York, Friday, June
18th, 1853, the following preamble and resolutions were adopted:
Whereas, A large number of swine are kept in various portions of
the city; and whereas, it is the general practice of persons so
keeping swine, to boil offal and kitchen refuse and garbage, whereby
a highly offensive and dangerous nuisance is created, therefore, be
it
Resolved, That this Board, of the Mayor and Commissioners of
Health, deeming swine kept south of (86th) street, in this city, to be
creative of a nuisance and detrimental to the public health,
therefore, the City Inspector be, and he is hereby, authorized and
directed to take, seize, and remove from any and all places and
premises, all and every swine found or kept on any premises in any
place in the city of New York southerly of said street, and to cause
all such swine to be removed to the Public Pound, or other suitable
place beyond the limits of the city or northerly of said street, and to
cause all premises or places wherein, or on which, said swine may
have been so found or kept, to be thoroughly cleaned and purified
as the City Inspector shall deem necessary to secure the
preservation of the public health, and that all expenses incurred
thereby constitute a lien on the lot, lots or premises from which said
nuisance shall have been abated or removed.
Resolved, That the foregoing resolutions shall take effect from and
after the first day of July next, and that public notice be given of the
same by publication in the Corporation papers to that date, and that
notice may be given to persons keeping swine by circulars delivered
on the premises, and that all violations of this order be prosecuted
by the proper legal authorities, on complaint from the City Inspector
or his officers.
City Inspector’s Department, }
New York, June 18, 1858. }
All persons keeping swine, or upon whose property or premises
the same may be kept, are hereby notified that the above
resolutions will be strictly enforced from and after the first day of
July next.
GEO. W. MORTON, City Inspector.

F RANCIS B. BALDWIN, WHOLESALE and RETAIL CLOTHING &


FURNISHING WAREHOUSE, 70 and 72 Bowery, between Canal
and Hester sts., New York. Large and elegant assortment of Youths’
and Boys’ Clothing.
F. B. BALDWIN,
J. G. BARNUM.
F. B. BALDWIN has just opened his New and Immense
Establishment. THE LARGEST IN THE CITY! An entire New Stock of
GENTLEMEN’S, YOUTH’S and CHILDREN’S CLOTHING, recently
manufactured, by the best workmen in the city, is now opened for
inspection. Also, a superior stock of FURNISHING GOODS. All articles
are of the Best Quality, and having been purchased during the crisis,
WILL BE SOLD VERY LOW! The Custom Department contains the
greatest variety of CLOTHS, CASSIMERES, and VESTINGS.
Mr. BALDWIN has associated with him Mr. J. G. BARNUM, who has
had great experience in the business, having been thirty years
connected with the leading Clothing Establishments of the city.

T HOMAS A. DUNN, 506 EIGHTH AVENUE, has a very choice


assortment of Wines, Brandies, Cordials, and Segars, which he
will sell at prices that will yield a fair profit. All my democratic
friends, and my immediate associates in the Boards of Aldermen and
Councilmen are respectfully invited to call in their rambles through
Eighth Avenue, and enjoy a good Havana segar, and nice, sparkling
champagne, and very exhilerating brandy. For the segars, I will
charge my political friends and associates only five pence each, and
for the brandy only ten pence per half gill, and for the champagne
only four shillings a glass, or two dollars a bottle.
So call, kind friends, and sing a glee,
And laugh and smoke and drink with me,
Sweet Sangaree
Till you can’t see:
(Chorus)—At your expense!
(Which pays my rents,)
For my fingers do you see
O’er my nose gyrating free?

THOMAS A. DUNN, No. 506 Eighth avenue.

J. VAN TINE, SHANGAE RESTAURANT, No. 2, Dey street, New


York.

C OREY AND SON, MERCHANT’S EXCHANGE, Wall street, New


York.—Notaries Public and Commissioners.—United State’s
Passports issued in 36 hours.—Bills of Exchange, Drafts, and Notes
protested.—Marine protests noted and extended.
EDWIN F. COREY,
EDWIN F. COREY, Jr.

M RS. S. S. BIRD’S LADIES’ AND GENTLEMEN’S Dining and Oyster


Saloons, No. 31 Canal street, near East Broadway, and 264
Division street, New York.
Oysters Pickled to Order.

S
S. & J. W. BARKER, GENERAL AUCTIONEERS & REAL ESTATE
BROKERS. Loans negotiated, Houses and Stores Rented, Stocks
and Bonds Sold at Auction or Private Sale.
Also, FURNITURE SALES attended to at private houses. Office, 14
Pine street, under Commonwealth Bank.

C ARLTON HOUSE, 496 BROADWAY, NEW York. Bates and Holden,


Proprietors.
THEOPHILUS BATES.
OREL J. HOLDEN.

T RIMMING MANUFACTURERS.—B. S. YATES & CO., 639 Broadway,


New York.
Fringes, Cords, Tassels, Loops, Gimps,
and Gimp Bands.

W M. COULTER, Carpenter.—I have long been engaged as a


Carpenter, and I assure all who will favor me with their
patronage, that I will build as good houses, or anything else in my
line, as any other carpenter in the city of New York. I will also be as
reasonable in charges for my work as any other person.
WILLIAM COULTER, Carpenter,
Rear of 216 East Twentieth street, New York.

G ERARD BETTS & CO., AUCTION AND Commission Merchants,


No. 106, Wall street, corner of Front street, New York.

J
J AMES DONNELLY’S COAL YARD,—Twenty-sixth street and Second
Avenue. I always have all kinds of coal on hand, and of the very
best quality, which I will sell as low as any other coal dealer in the
United States.
JAMES DONNELLY.

F OLEY’S CELEBRATED “GOLD PENS.” For sale by all Stationers and


Jewellers.
OFFICE AND STORE,
163 BROADWAY.

W. W. OSBORN, MERCHANT TAILOR, 9 Chamber street, near


Chatham street, New York.

S OLOMON BANTA, Architect, No. 93 Amos street, New York. I


have built as many houses and stores as any Architect in this
city, or the United States, and I can produce vouchers to that effect;
and I flatter myself that I can build edifices that will compare
favorably, in point of beauty and durability, with those of any
architect in this country. I am prepared to receive orders in my line
of business, at No. 93 Amos street. New York.
SOLOMON BANTA.

R OBERT ONDERDONK—THIRTEENTH Ward Hotel, 405 and 407


Grand street, corner of Clinton street, New York.

W
W ILLIAM M. TWEED, CHAIR, & OFFICE Furniture Dealer and
Manufacturer,
No. 289 Broadway, corner of Read street New York. Room No. 15.

T RUSSES, ELASTIC STOCKINGS, SHOULDER Braces, Supporters,


Bandages, &c. H. L. Parsons, E. D. Office, 4 Ann street, under
the Museum.

F ASHION HOUSE.—JOSEPH HYDE PROPRIETOR, corner Grand and


Essex street. Wines, Liquors, and Cigars of the best brands. He
invites his friends to give him a call. Prompt and courteous attention
given his patrons.

W ILLIAM A. CONKLIN, ATTORNEY AND COUNSELLOR AT LAW,


No. 176 Chatham street, New York. Any business entrusted to
his charge from citizens of this city or any part of the country, will
receive prompt and faithful attention, and be conducted on
reasonable terms.
WILLIAM A. CONKLIN.

H ERRING’S PATENT CHAMPION FIRE AND BURGLAR Proof Safe,


with Hall’s Patent Powder Proof Locks, afford the greatest
security of any Safe in the world. Also, Sideboard and Parlor Safes,
of elegant workmanship and finish, for plate, &c. S. C. HERRING &
CO.,
251 Broadway.

J
J AMES MELENFY, (SUCCESSOR TO SAMUEL Hopper,) Grocer, and
Wholesale and Retail Dealer in Pure Country Milk. Teas, Coffee,
Sugars & Spices. Flour, Butter, Lard, Cheese, Eggs &c. No. 158,
Eighth Avenue, Near 18th Street, New York. Families supplied by
leaving their address at the Store.

B OOT & SHOE EMPORIUMS. EDWIN A. BROOKS, Importer and


Manufacturer of Boots, Shoes & Gaiters, Wholesale and Retail,
No. 575 Broadway, and 150 Fulton Street, New York.

M CSPEDON AND BAKER’S STATIONERY WAREHOUSE and


Envelope Manufactory, Nos. 29, 31, and 33, Beekman Street,
New York.
Envelopes of all patterns, styles, and quality, on hand, and made to
order for the trade and others, by Steam Machinery. Patented April
8th, 1856.

C OZZENS’ HOTEL COACHES,—STABLE, Nos. 34 and 36 Canal


Street, New York.
I will strive hard to please all those generous citizens who will
kindly favor me with their patronage.
EDWARD VAN RANST.

J. W. MASON, MANUFACTURER, WHOLESALE and Retail dealers in


all kinds of Chairs, Wash Stands, Settees, &c. 377 & 379 Pearl
Street, New York.
Cane and Wood Seat Chairs, in Boxes, for Shipping.

B
B ENJAMIN JONES, COMMISSION DEALER, IN Real Estate. Houses
and stores and lots for sale in all parts of the city. Office at the
junction of Broadway, Seventh Avenue, and Forty-Sixth Street.

F ULLMER AND WOOD, CARRIAGE Manufacturers, 239 West 19th


Street, New York.
Horse-shoeing done with despatch, and in the most scientific
manner, and on reasonable terms.

J. N. GENIN, FASHIONABLE HATTER, 214 Broadway, New York.

G ENIN’S LADIES’ & CHILDREN’S OUTFITTING Bazaar, 513


Broadway, (St. Nicholas Hotel, N. Y.)

E DWARD PHALON & SON, 497 and 517 Broadway, New York—
Depots for the sale of Perfumery, and every article connected
with the Toilet.
We now introduce the “BOUQUET D’OGARITA, or Wild Flower of
Mexico,” which is superior to any thing of the kind in the civilized
world.
EDWARD PHALON & SON.

S AMUEL SNEDEN, SHIP & STEAMBOAT BUILDER.—My Office is at


No. 31 Corlears Street, New York; and my yards and residence
are at Greenpoint. I have built Ships and Steamers for every portion
of the Globe, for a long term of years, and continue to do so on
reasonable terms.
SAMUEL SNEDEN.

J OHN B. WEBB, BOAT BUILDER, 718 WATER STREET. My Boats


are of models and materials unsurpassed by those of any Boat
Builder in the World. Give me a call, and if I don’t please you, I will
disdain to charge you for what does not entirely satisfy you.
JOHN B. WEBB.

A LANSON T. BRIGGS—DEALER IN FLOUR BARRELS, Molasses


Casks, Water, and all other kinds of Casks. Also, new flour
barrels and half-barrels; a large supply constantly on hand. My
Stores are at Nos. 62, 63, 64, 69, 73, 75, 77 and 79 Rutger’s Slip; at
235, 237, and 239 Cherry Street; also, in South and Water streets,
between Pike and Rutger’s Slip, extending from street to street. My
yards in Williamsburgh are at Furman & Co.’s Dock. My yards in New
York are at the corner of Water and Gouverneur Streets; and in
Washington Street, near Canal; and at Leroy Place. My general
Office is at 64 Rutger’s Slip.
ALANSON T. BRIGGS.

F ULTON IRON WORKS.—JAMES MURPHY & CO., manufacturers of


Marine and Land Engines, Boilers, &c. Iron and Brass Castings.
Foot of Cherry street, East River.

B RADDICK & HOGAN, SAILMAKERS, No. 272 South Street, New


York.
Awnings, Tents, and Bags made to order.
JESSE A. BRADDICK,
RICHARD HOGAN.

W ILLIAM M. SOMERVILLE, WHOLESALE AND Retail Druggist and


Apothecary, 205 Bleecker-st., corner Minetta, opposite Cottage
Place, New York. All the popular Patent Medicines, fresh Swedish
Leeches, Cupping, &c. Physicians’ Prescriptions accurately prepared.
WM. M. SOMERVILLE.

A. W. & T. HUME, MERCHANT TAILORS, No. 82 Sixth Avenue,


New York. We keep a large and elegant assortment of every
article that a gentleman requires. We make Coats, Vests and Pants,
after the latest Parisian fashions, and on reasonable terms.
A. W. & T. HUME.

T HE WASHINGTON, By BARTLETT & GATES, No. 1 Broadway, New


York. Come and see us, good friends, and eat and drink and be
merry, in the same capacious and patriotic halls where the immortal
Washington’s voice and laugh once reverberated.
O come to our Hotel,
And you’ll be treated well.

BARTLETT & GATES.

E XCELSIOR PRINTING HOUSE, 211 CENTRE ST., IS furnished with


every facility, latest improved presses, and the newest styles of
type—for the execution of Book, Job and Ornamental Printing. Call
and see specimens.

C
C HARLES FRANCIS, SADDLER, (ESTABLISHED IN 1808,) Sign of
the Golden Horse, 39 Bowery, New York, opposite the Theatre.
Mr. F. will sell his articles as low as any other Saddler in America, and
warrant them to be equal to any in the World.

H. N. WILD, STEAM CANDY MANUFACTURER, No. 451 Broadway,


bet. Grand and Howard streets, New York. My Iceland Moss
and Flaxseed Candy will cure Coughs and Sneezes in a very short
time.

J AMES GRIFFITHS, (Late CHATFIELD & GRIFFITHS,) No. 273


Grand st., New York. A large stock of well-selected Cloths,
Cassimeres, Vestings, &c., on hand. Gent’s, Youths’ and Children’s
Clothing, Cut and Made in the most approved style. All cheap for
Cash.

J. AGATE & CO., MEN’S FURNISHING


Manufacturers, 256 Broadway, New York.
GOODS and Shirt

Shirts made to order and guaranteed to fit.


J. AGATE, F. W. TALKINGTON.

B ILLIARD TABLES.—PHELAN’S IMPROVED BILLIARD Tables and


Combination Cushions—Protected by letters patent, dated Feb.
19, 1856; Oct. 28, 1856; Dec. 8, 1857; Jan. 12, 1858. The recent
improvement in these Tables make them unsurpassed in the world.
They are now offered to the scientific Billiard players as combining
speed with truth, never before obtained in any Billiard Table. Sales-
rooms Nos. 786 and 788 Broadway, New York. Manufactory No. 53
Ann Street.
O’CONNOR & COLLENDOR, Sole Manufacturers.

S. L. OLMSTEAD, IMPORTER, MANUFACTURER and Jobber of


Men’s Furnishing Goods, No. 24 Barclay Street, corner of
Church, New York.

C. B. HATCH, HILLER & MERSEREAU, Importers and Jobbers of


Men’s Furnishing Goods, and Manufacturers of the Golden Hill
Shirts, 99 Chambers Street, N. E. corner Church Street, New York.

L. A. ROSENMILLER, DRUGGIST, NO. 172 EIGHTH Avenue, New


York. Cupping & Leeching. Medicines at all hours.
*** END OF THE PROJECT GUTENBERG EBOOK STEPHEN H.
BRANCH'S ALLIGATOR, VOL. 1 NO. 12, JULY 10, 1858 ***

Updated editions will replace the previous one—the old editions


will be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States
copyright in these works, so the Foundation (and you!) can copy
and distribute it in the United States without permission and
without paying copyright royalties. Special rules, set forth in the
General Terms of Use part of this license, apply to copying and
distributing Project Gutenberg™ electronic works to protect the
PROJECT GUTENBERG™ concept and trademark. Project
Gutenberg is a registered trademark, and may not be used if
you charge for an eBook, except by following the terms of the
trademark license, including paying royalties for use of the
Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such
as creation of derivative works, reports, performances and
research. Project Gutenberg eBooks may be modified and
printed and given away—you may do practically ANYTHING in
the United States with eBooks not protected by U.S. copyright
law. Redistribution is subject to the trademark license, especially
commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the


free distribution of electronic works, by using or distributing this
work (or any other work associated in any way with the phrase
“Project Gutenberg”), you agree to comply with all the terms of
the Full Project Gutenberg™ License available with this file or
online at www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand,
agree to and accept all the terms of this license and intellectual
property (trademark/copyright) agreement. If you do not agree
to abide by all the terms of this agreement, you must cease
using and return or destroy all copies of Project Gutenberg™
electronic works in your possession. If you paid a fee for
obtaining a copy of or access to a Project Gutenberg™
electronic work and you do not agree to be bound by the terms
of this agreement, you may obtain a refund from the person or
entity to whom you paid the fee as set forth in paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only


be used on or associated in any way with an electronic work by
people who agree to be bound by the terms of this agreement.
There are a few things that you can do with most Project
Gutenberg™ electronic works even without complying with the
full terms of this agreement. See paragraph 1.C below. There
are a lot of things you can do with Project Gutenberg™
electronic works if you follow the terms of this agreement and
help preserve free future access to Project Gutenberg™
electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright
law in the United States and you are located in the United
States, we do not claim a right to prevent you from copying,
distributing, performing, displaying or creating derivative works
based on the work as long as all references to Project
Gutenberg are removed. Of course, we hope that you will
support the Project Gutenberg™ mission of promoting free
access to electronic works by freely sharing Project Gutenberg™
works in compliance with the terms of this agreement for
keeping the Project Gutenberg™ name associated with the
work. You can easily comply with the terms of this agreement
by keeping this work in the same format with its attached full
Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.

1.E. Unless you have removed all references to Project


Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project
Gutenberg™ work (any work on which the phrase “Project
Gutenberg” appears, or with which the phrase “Project
Gutenberg” is associated) is accessed, displayed, performed,
viewed, copied or distributed:

This eBook is for the use of anyone anywhere in the United


States and most other parts of the world at no cost and
with almost no restrictions whatsoever. You may copy it,
give it away or re-use it under the terms of the Project
Gutenberg License included with this eBook or online at
www.gutenberg.org. If you are not located in the United
States, you will have to check the laws of the country
where you are located before using this eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is


derived from texts not protected by U.S. copyright law (does not
contain a notice indicating that it is posted with permission of
the copyright holder), the work can be copied and distributed to
anyone in the United States without paying any fees or charges.
If you are redistributing or providing access to a work with the
phrase “Project Gutenberg” associated with or appearing on the
work, you must comply either with the requirements of
paragraphs 1.E.1 through 1.E.7 or obtain permission for the use
of the work and the Project Gutenberg™ trademark as set forth
in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is


posted with the permission of the copyright holder, your use and
distribution must comply with both paragraphs 1.E.1 through
1.E.7 and any additional terms imposed by the copyright holder.
Additional terms will be linked to the Project Gutenberg™
License for all works posted with the permission of the copyright
holder found at the beginning of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files
containing a part of this work or any other work associated with
Project Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute


this electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the
Project Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must,
at no additional cost, fee or expense to the user, provide a copy,
a means of exporting a copy, or a means of obtaining a copy
upon request, of the work in its original “Plain Vanilla ASCII” or
other form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™
works unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or


providing access to or distributing Project Gutenberg™
electronic works provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project


Gutenberg™ electronic work or group of works on different
terms than are set forth in this agreement, you must obtain
permission in writing from the Project Gutenberg Literary
Archive Foundation, the manager of the Project Gutenberg™
trademark. Contact the Foundation as set forth in Section 3
below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on,
transcribe and proofread works not protected by U.S. copyright
law in creating the Project Gutenberg™ collection. Despite these
efforts, Project Gutenberg™ electronic works, and the medium
on which they may be stored, may contain “Defects,” such as,
but not limited to, incomplete, inaccurate or corrupt data,
transcription errors, a copyright or other intellectual property
infringement, a defective or damaged disk or other medium, a
computer virus, or computer codes that damage or cannot be
read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except


for the “Right of Replacement or Refund” described in
paragraph 1.F.3, the Project Gutenberg Literary Archive
Foundation, the owner of the Project Gutenberg™ trademark,
and any other party distributing a Project Gutenberg™ electronic
work under this agreement, disclaim all liability to you for
damages, costs and expenses, including legal fees. YOU AGREE
THAT YOU HAVE NO REMEDIES FOR NEGLIGENCE, STRICT
LIABILITY, BREACH OF WARRANTY OR BREACH OF CONTRACT
EXCEPT THOSE PROVIDED IN PARAGRAPH 1.F.3. YOU AGREE
THAT THE FOUNDATION, THE TRADEMARK OWNER, AND ANY
DISTRIBUTOR UNDER THIS AGREEMENT WILL NOT BE LIABLE
TO YOU FOR ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL,
PUNITIVE OR INCIDENTAL DAMAGES EVEN IF YOU GIVE
NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of
receiving it, you can receive a refund of the money (if any) you
paid for it by sending a written explanation to the person you
received the work from. If you received the work on a physical
medium, you must return the medium with your written
explanation. The person or entity that provided you with the
defective work may elect to provide a replacement copy in lieu
of a refund. If you received the work electronically, the person
or entity providing it to you may choose to give you a second
opportunity to receive the work electronically in lieu of a refund.
If the second copy is also defective, you may demand a refund
in writing without further opportunities to fix the problem.

1.F.4. Except for the limited right of replacement or refund set


forth in paragraph 1.F.3, this work is provided to you ‘AS-IS’,
WITH NO OTHER WARRANTIES OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of
damages. If any disclaimer or limitation set forth in this
agreement violates the law of the state applicable to this
agreement, the agreement shall be interpreted to make the
maximum disclaimer or limitation permitted by the applicable
state law. The invalidity or unenforceability of any provision of
this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the


Foundation, the trademark owner, any agent or employee of the
Foundation, anyone providing copies of Project Gutenberg™
electronic works in accordance with this agreement, and any
volunteers associated with the production, promotion and
distribution of Project Gutenberg™ electronic works, harmless
from all liability, costs and expenses, including legal fees, that
arise directly or indirectly from any of the following which you
do or cause to occur: (a) distribution of this or any Project
Gutenberg™ work, (b) alteration, modification, or additions or
deletions to any Project Gutenberg™ work, and (c) any Defect
you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new
computers. It exists because of the efforts of hundreds of
volunteers and donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project
Gutenberg™’s goals and ensuring that the Project Gutenberg™
collection will remain freely available for generations to come. In
2001, the Project Gutenberg Literary Archive Foundation was
created to provide a secure and permanent future for Project
Gutenberg™ and future generations. To learn more about the
Project Gutenberg Literary Archive Foundation and how your
efforts and donations can help, see Sections 3 and 4 and the
Foundation information page at www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-
profit 501(c)(3) educational corporation organized under the
laws of the state of Mississippi and granted tax exempt status
by the Internal Revenue Service. The Foundation’s EIN or
federal tax identification number is 64-6221541. Contributions
to the Project Gutenberg Literary Archive Foundation are tax
deductible to the full extent permitted by U.S. federal laws and
your state’s laws.

The Foundation’s business office is located at 809 North 1500


West, Salt Lake City, UT 84116, (801) 596-1887. Email contact
links and up to date contact information can be found at the
Foundation’s website and official page at
www.gutenberg.org/contact
Section 4. Information about Donations to
the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission
of increasing the number of public domain and licensed works
that can be freely distributed in machine-readable form
accessible by the widest array of equipment including outdated
equipment. Many small donations ($1 to $5,000) are particularly
important to maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws


regulating charities and charitable donations in all 50 states of
the United States. Compliance requirements are not uniform
and it takes a considerable effort, much paperwork and many
fees to meet and keep up with these requirements. We do not
solicit donations in locations where we have not received written
confirmation of compliance. To SEND DONATIONS or determine
the status of compliance for any particular state visit
www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states


where we have not met the solicitation requirements, we know
of no prohibition against accepting unsolicited donations from
donors in such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot


make any statements concerning tax treatment of donations
received from outside the United States. U.S. laws alone swamp
our small staff.

Please check the Project Gutenberg web pages for current


donation methods and addresses. Donations are accepted in a
number of other ways including checks, online payments and
credit card donations. To donate, please visit:
www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could
be freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose
network of volunteer support.

Project Gutenberg™ eBooks are often created from several


printed editions, all of which are confirmed as not protected by
copyright in the U.S. unless a copyright notice is included. Thus,
we do not necessarily keep eBooks in compliance with any
particular paper edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg
Literary Archive Foundation, how to help produce our new
eBooks, and how to subscribe to our email newsletter to hear
about new eBooks.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like