Ruby on Rails Tutorial Learn Web Development with Rails 3rd Edition Michael Hartl instant download
Ruby on Rails Tutorial Learn Web Development with Rails 3rd Edition Michael Hartl instant download
https://ebookultra.com/download/ruby-on-rails-tutorial-learn-web-
development-with-rails-3rd-edition-michael-hartl/
https://ebookultra.com/download/agile-web-development-with-
rails-5-1st-edition-sam-ruby/
https://ebookultra.com/download/railsspace-building-a-social-
networking-website-with-ruby-on-rails-addison-wesley-professional-
ruby-series-hartl/
https://ebookultra.com/download/agile-web-development-with-rails-4th-
edition-beta-10-version-sam-ruby/
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/
https://ebookultra.com/download/ruby-on-rails-for-dummies-1st-edition-
burd/
https://ebookultra.com/download/ruby-on-rails-background-jobs-with-
sidekiq-1-converted-edition-david-b-copeland/
https://ebookultra.com/download/practical-reporting-with-ruby-and-
rails-1st-edition-david-berube/
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
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
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
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.
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.
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.
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.
W
W ILLIAM M. TWEED, CHAIR, & OFFICE Furniture Dealer and
Manufacturer,
No. 289 Broadway, corner of Read street New York. Room No. 15.
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
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.
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.
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.
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.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.
• 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 comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
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.
ebookultra.com