Learning Rails 3Simon St.Laurent, Edd Dumbill, and Eric J... Learning Rails 3by Simon St.Laurent, Edd Dumbill, and Eric J.. Gruber Copyright © 2012 Simon St.Laurent, Edd Dumbill, Eric J.
Trang 3Learning Rails 3
Simon St.Laurent, Edd Dumbill, and Eric J Gruber
Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo
Trang 4Learning Rails 3
by Simon St.Laurent, Edd Dumbill, and Eric J Gruber
Copyright © 2012 Simon St.Laurent, Edd Dumbill, Eric J Gruber All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472 O’Reilly books may be purchased for educational, business, or sales promotional use Online editions are also available for most titles (http://my.safaribooksonline.com) For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com.
Editor: Simon St.Laurent
Production Editor: Iris Febres
Proofreader: Jasmine Perez
Indexer: Lucie Haskins
Cover Designer: Karen Montgomery
Interior Designer: David Futato
Illustrators: Robert Romano, Rebecca Demarest, and Jessamyn Read
July 2012: First Edition
Revision History for the First Edition:
2012-07-11 First release
See http://oreilly.com/catalog/errata.csp?isbn=9781449309336 for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc Learning Rails 3, the image of the tarpans, and related trade dress are trademarks
of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-tained herein.
ISBN: 978-1-449-30933-6
[M]
1342467902
Trang 5Table of Contents
Preface xi
1 Starting Up Ruby on Rails 1
2 Rails on the Web 11
3 Adding Web Style 23
iii
Trang 6About the Authors
Simon St.Laurent is a web developer, network administrator, computer book author,
and XML troublemaker living in Ithaca, NY His books include XML: A Primer, XML
Elements of Style, and Building XML Applications, Cookies, and Sharing Bandwidth He
Edd Dumbill is a technologist, writer, and programmer based in California He is the
program chair for the O’Reilly Strata and Open Source Convention Conferences
Eric J Gruber works as a web developer in municipal government for the City of
Rum-blestrut (http://www.rumblestrut.com/)
Colophon
The animals on the cover of Learning Rails 3 are tarpans (Equus ferus ferus) The tarpan
was a wild horse that lived in Europe and Asia and died out in the 19th century Smaller and stockier than a modern domestic horse, it was mouse-gray in color with a dark mane and a black stripe down its back The breed was known to be intelligent, curious, and independent
The ancient tarpan ranged from southern France and Spain to central Russia Its decline was caused by the growth of the European human population in the 17th and 18th centuries, which encroached on the tarpan’s natural habitat Tarpans were also hunted for their meat The last wild tarpan died in Ukraine in 1879, and the last pure tarpan died in a Russian zoo eight years later, at which point the species officially became extinct
However, you can still see a tarpan today, thanks to two German zoologists who suc-ceeded in genetically recreating the breed in the 1930s Heinz and Lutz Heck began a breeding program while working at a Munich zoo, believing that genes still present in the gene pool of an overall species could be used to recreate extinct breeds They combined the genes of living horses who showed similar characteristics to the ancient tarpan, and bred the first modern tarpan at the zoo in 1933 This new form of tarpan, known as the Heck horse, is a phenotypic copy of the original wild breed, meaning that
it resembles the ancient tarpan but is not exactly the same genetically Today, there are about 50 tarpans in North America, all of which trace back to the original project in Munich Most of them are owned by private breeders who are trying to increase the tarpan population There are not many more than 100 tarpans in the world
The cover image is from Richard Lydekker’s Royal Natural History The cover font is
Adobe ITC Garamond The text font is Linotype Birka; the heading font is Adobe Myriad Condensed; and the code font is LucasFont’s TheSansMonoCondensed