This book is for web developers wanting to master two of the most promising recent developments in the field: Ajax and Ruby on Rails. By the end of this book, you'll be equipped with the knowledge to build richly interactive web applications with Rails.
Assumptions This Book Makes
This book assumes that you're familiar with the basic technologies used in building dynamic web sites, on both the client and server sides.
On the server side, no specific language experience is assumed, but some grasp of the basic concepts is. If you have experience building web applications in a language like PHP, Java, or ASP, you'll have no trouble understanding the concepts behind Ruby on Rails. But, because this book doesn't cover everything there is to know about Ruby and Rails, you'll want to augment it with other resourcessuch as those recommended in Chapter 1.
Contents of This Book
The first part, encompassing Chapters 1 through 5, is a tutorial. Each chapter builds on the previous, and each chapter balances theory and practice. Chapter 1 starts from scratchinstalling Ruby and Rails, introducing the fundamental concepts of Ajax development, and providing the context and rationale for the rest of the book. In Chapter 2, the idea is to take a walking tour, in baby steps, through some really simple Ajax examples. Rails provides a powerful suite of shortcuts for Ajax development. But to get the most out of them, it's essential to understand the "long" solution first; that's exactly the approach taken in Chapter 2. Chapters 3 and 4 introduce the shortcuts (Rails' helper methods), which are the workhorses of the Rails way. Lastly, Chapter 5 is the guide to the crown jewel of Ajax on Rails: RJS.
In the second part, we step back from the tutorial format and look at larger themes of professional web development. Chapter 6 deals with usability, cross-platform development, and how Ajax techniques relate to those problems. Chapter 7 coverslogging, testing, and debugging. Chapter 8 is on securityalways a consideration in web application development, especially when handling financial or other sensitive information. Performance and scalability are covered in Chapter 9. Snappy performance is often the most obvious benefit of Ajaxbut that doesn't mean performance issues don't arise.
Sometimes, the best way to master new technology is to go straight to the source. So the book ends with three complete, professionally designed example applications, each showcasing different Ajax techniques in the context of a real application.
Conventions Used in This Book
The following typographical conventions are used in this book:
Using Code Examples
This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you're reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O'Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product's documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: "Ajax on Rails by Scott Raymond. Copyright 2007 O'Reilly Media, Inc., 978-0-596-52744-0."
If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at firstname.lastname@example.org.
We'd Like to Hear from You
Please address comments and questions concerning this book to the publisher:
We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at:
To comment or ask technical questions about this book, send email to:
For more information about our books, conferences, Resource Centers, and the O'Reilly Network, see our web site at:
When you see a Safari® Enabled icon on the cover of your favorite technology book, that means the book is available online through the O'Reilly Network Safari Bookshelf.
Safari offers a solution that's better than e-books. It's a virtual library that lets you easily search thousands of top tech books, cut and paste code samples, download chapters, and find quick answers when you need the most accurate, current information. Try it for free at http://safari.oreilly.com.
First, I'm honored to have Sergio Pereira's contribution of Chapter 10it's a tremendous boon to the book.
If not for my wife's tireless encouragement and valuable suggestions, I'd still be writing thisthank you, Brooke! I'm very grateful to the rest of my family, especially my parents, Doug and Katy. I'm also indebted to my editor, Michael Loukides, an invaluable guide through the process of writing this book. Thanks to Derek Di Matteo for his adept copyediting.
Thank you to these technical reviewers, whose expertise and attention to detail shaped the book significantly: John Aughey, Trey Bean, Jeremy Copling, Kevin Eshleman, Cody Fauser, Brian Ford, Thomas Fuchs, Erik Kastner, Thomas Lockney, Marcel Molina Jr., Tim Samoff, Brian Spaid, Sam Stephenson, and Bruce Williams.
Thanks to the Rails core team and all those who've contributed to Rails, Prototype, and script.aculo.us.
Lastly, thanks to Kansas City's fine coffee houses that supported this project with espresso and Wi-Fi: Broadway Café, Latté Land, and The Roasterie.