Rails, Angular, Postgres, and Bootstrap, Second Edition
Powerful, Effective, Efficient, Full-Stack Web Development
by David Bryant Copeland
Version: P1.0 (June 2017)
Copyright 2017 The Pragmatic Programmers, LLC. This book is licensed to the individual who purchased it. We don't copy-protect it because that would limit your ability to use it for your own purposes. Please don't break this trustyou can use this across all of your devices but please do not share this copy with other members of your team, with friends, or via file sharing services. Thanks.
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 The Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g device are trademarks of The Pragmatic Programmers, LLC.
Every precaution was taken in the preparation of this book. However, the publisher assumes no responsibility for errors or omissions, or for damages that may result from the use of information (including program listings) contained herein.
About the Pragmatic Bookshelf
The Pragmatic Bookshelf is an agile publishing company. Were here because we want to improve the lives of developers. We do this by creating timely, practical titles, written by programmers for programmers.
Our Pragmatic courses, workshops, and other products can help you and your team create better software and have more fun. For more information, as well as the latest Pragmatic titles, please visit us at http://pragprog.com.
Our ebooks do not contain any Digital Restrictions Management, and have always been DRM-free. We pioneered the beta book concept, where you can purchase and read a book while its still being written, and provide feedback to the author to help make a better book for everyone. Free resources for all purchasers include source code downloads (if applicable), errata and discussion forums, all available on the book's home page at pragprog.com. Were here to make your life easier.
New Book Announcements
Want to keep up on our latest titles and announcements, and occasional special offers? Just create an account on pragprog.com (an email address and a password is all it takes) and select the checkbox to receive newsletters. You can also follow us on twitter as @pragprog.
About Ebook Formats
If you buy directly from pragprog.com, you get ebooks in all available formats for one price. You can synch your ebooks amongst all your devices (including iPhone/iPad, Android, laptops, etc.) via Dropbox. You get free updates for the life of the edition. And, of course, you can always come back and re-download your books when needed. Ebooks bought from the Amazon Kindle store are subject to Amazon's polices. Limitations in Amazon's file format may cause ebooks to display differently on different devices. For more information, please see our FAQ at pragprog.com/frequently-asked-questions/ebooks. To learn more about this book and access the free resources, go to https://pragprog.com/book/dcbang2, the book's homepage.
Thanks for your continued support,
Andy Hunt
The Pragmatic Programmers
The team that produced this book includes: Andy Hunt (Publisher) Janet Furlow (VP of Operations) Susannah Davidson Pfalzer (Executive Editor) Katharine Dvorak (Development Editor) Potomac Indexing, LLC (Indexing) Liz Welch (Copy Editor) Gilson Graphics (Layout)
For customer support, please contact .
For international rights, please contact .
Table of Contents
Copyright 2017, The Pragmatic Bookshelf.
Early praise for Rails, Angular, Postgres, and Bootstrap, Second Edition
Rails, Angular, Postgres, and Bootstrap, Second Edition is an informative and engaging tool for Rails developers to level up their skills. Dave uses real-world product examples to explain concepts, making it feel natural to apply your newfound database and front-end expertise to your everyday work.
Cameron Jacoby |
Software engineer, Stitch Fix |
This book is a great introduction to modern full-stack development. Youll learn how to create rich front-end experiences and performant databases, all the while working with the joy that is Rails.
Matthew White |
Author of Deliver Audacious Web Apps with Ember |
I found this to be an excellent book. It is well written, correct, and up to date; covers exciting OSS technologies; and has a clear sense of its audience and its needs. I intend to recommend this book to my Rails teamit will expand our competencies even further.
Tibor Simic |
Developer, Ingemark |
I recommend Rails, Angular, Postgres, and Bootstrap, Second Edition without question. It is a great book for any developer who needs a straightforward and rich experience with the full-stack web development philosophy. It is also a great choice for any developer who wants to pair his or her Rails knowledge with bleeding-edge tools and progressively ascend to full-stack.
Peter Perlepes |
Software engineer, Adaplo |
Acknowledgments
Id like to first thank my wife Amy, who gave me the encouragement and space to spend time every morning writing this book (twice).
Id also like to thank my first edition editor, Fahmida Rashid, as well as the editor of this edition, Katharine Dvorak, who helped me navigate the ever-changing JavaScript ecosystem so we could give you an updated book that actually went to print.
Id further like to thank the many people who reviewed this new edition: Luis Miguel Cabezas Granado, Fabrizio Cucci, Cameron Jacoby, Nigel Lowry, David McClain, Nick McGinness, Peter Perlepes, Sven Riedel, Tibor Simic, and Matthew White.
Finally, Id like to thank the contributors to the software youre learning about in this book. To the people who have given their free time to make Ruby, Rails, Postgres, Angular, Bootstrap, PhantomJS, Testdouble, Poltergeist, Devise, Capybara, RSpec, Database Cleaner, Yarn, and all the other open source software that are far too numerous to list here, thank you. Without your work, most developers would have a hard time doing their jobs.
Copyright 2017, The Pragmatic Bookshelf.
Introduction
Think about what part of an application youre most comfortable working with. If youre a Rails developer, theres a good chance you prefer the back end, the Ruby code that powers the business logic of your application. What if you felt equally comfortable working with the database, such as tweaking queries and using advanced features of your database system? What if you were also comfortable working with the JavaScript and CSS necessary to make dynamic, usable, attractive user interfaces?
If you had that level of comfort at every level of the application stack, you would possess great power as a developer to quickly produce high-quality software. Your ability to solve problems would not be restricted by the tools available via a single framework, nor would you be at the mercy of hard-to-find specialists to help you with what are, in reality, simple engineering tasks.
The Rails framework encourages developers not to peer too closely into the database. Rails steers you away from JavaScript frameworks in favor of its sprinkling approach, where content is all rendered server-side. This book is going to open your eyes to all the things you can accomplish with your database, and set you on a path that includes JavaScript frameworks. With Rails acting as the foundation of what you do, youll learn how to embrace all other parts of the application stack.