Want to receive a weekly email containing
the scoop on our new titles along with the
occasional special offer? Just click the button.
(You can always unsubscribe later by editing your
account information).

Give us an email and a password (you can use the password later to log in and
change your preferences). We'll send you a newsletter roughly once a week.

The Rails View: Create a Beautiful and Maintainable User Experience

by John Athayde and Bruce Williams

The chart shows the approximate number of words in each chapter of The Rails View per week. The latest numbers are highlighted—mouse over prior weeks to see their figures.

Working in the Rails View layer requires a breadth of knowledge and attention to detail unlike anywhere else in Rails. One wrong move can result in brittle, complex views that stop future development in its tracks. Break free from tangles of logic and markup in your views and implement your user interface cleanly and maintainably.

Out of Print

This book is currently out of print.

About this Book

264 pages

Published: 2012-03-23

Release: P1.1 (2012-04-06)

ISBN: 978-1-93435-687-6

In this book you’ll learn how to build up solid, sustainable layouts and popular interface elements with semantic HTML5 and CSS3. You’ll explore ways to make working with forms more manageable, and you’ll discover when you can responsibly generate markup and use advanced presenters—all without leaving the designers on your team out in the cold. You’ll even learn how to tame HTML emails so you can ensure your message reaches its intended audience.

Master the asset pipeline introduced in Rails 3.1 as you use Sass and Coffeescript to make your interface more enjoyable and your code shorter, and explore ways to present your application to that ever-growing mobile audience. You’ll see how to ensure that your interface stays snappy by evaluating its performance.

This book gives you comprehensive, objective guidance in a realm full of subjective opinions. Use it, and you’ll create elegant, well-structured views that are a joy to build upon.

What You Need:

All examples in the book assume Rails 3.1 or later and Ruby 1.9.x are installed. Detailed information on how to install these for Windows, Mac OS X and Linux is included in the book.

Top Ten View Rules

Our markup should have meaning. We write templates using semantic HTML.

Our style sheets should handle presentation. We don’t use markup to style or use images when CSS will do.

Our templates should be free of client-side code. We unobtrusively attach behavior from our JavaScript files.

Our templates should be easy to read. We consistently indent correctly using spaces instead of tabs, type lines no longer than eighty characters, and extract complex logic to helpers and presenters.

Our templates should be easy to find. We use standard naming conventions and place them in the directory for the related resource (or the layout).

Our markup should be easy for the entire team to modify. We prefer rendering partials over generating markup from Ruby code.

Our technology choices should help, not hinder, the team. We use the templating language and tools that work best for all of us.

Our designs for the Web should work on a variety of devices and browsers. We build for the simplest interactions first and support progressive enhancement.

Our designs for email must work for a wide range of providers. We use HTML tables and images as necessary and always provide a plain-text alternative.

Our application should perform as well as it needs to, when it needs to. We implement the most elegant approach first, then we optimize when necessary.

Top Ten View Rules

Our markup should have meaning. We write templates using semantic HTML.

Our style sheets should handle presentation. We don’t use markup to style or use images when CSS will do.

Our templates should be free of client-side code. We unobtrusively attach behavior from our JavaScript files.

Our templates should be easy to read. We consistently indent correctly using spaces instead of tabs, type lines no longer than eighty characters, and extract complex logic to helpers and presenters.

Our templates should be easy to find. We use standard naming conventions and place them in the directory for the related resource (or the layout).

Our markup should be easy for the entire team to modify. We prefer rendering partials over generating markup from Ruby code.

Our technology choices should help, not hinder, the team. We use the templating language and tools that work best for all of us.

Our designs for the Web should work on a variety of devices and browsers. We build for the simplest interactions first and support progressive enhancement.

Our designs for email must work for a wide range of providers. We use HTML tables and images as necessary and always provide a plain-text alternative.

Our application should perform as well as it needs to, when it needs to. We implement the most elegant approach first, then we optimize when necessary.

About the Author

John Athayde is a UI/UX Design type who comes from an architecture (of the building variety) background. He’s been in the Rails community since 2006 and has broad experience in e-commerce and running creative teams. He is a senior UI/UX designer at LivingSocial.

Bruce Williams is a longtime speaker, trainer, designer, and book contributor in the Ruby and Rails community and has experience in everything from low-level data processing backends to front-end user interaction. He is a senior developer in R&D at LivingSocial.

Comments and Reviews

This book represents the wisdom gained from years’ worth of building maintainable interfaces by two of
the best and brightest minds in our business. I have been writing Ruby code for
over a decade and Rails code since its inception, and out of all the Ruby books
I’ve read, I value this one the most.

—Rich KilmerDirectorRubyCentral

Finally! An authoritative and up-to-date guide to everything view-related in Rails 3.
If you’re stabbing in the dark when putting together your Rails apps’ views, The
Rails View provides a big confidence boost and shows how to get things done the
right way.

—Peter CooperEditorRuby Inside and Ruby Weekly

In the past several years, I’ve been privileged to work with some of the world’s
leading Rails developers. If asked to name the best view-layer Rails developer I’ve
met, I’d have a hard time picking between two names: Bruce Williams and John
Athayde. This book is a rare opportunity to look into the minds of two of the
leading experts on an area that receives far too little attention. Read, apply, and
reread.

—Chad FowlerVP EngineeringLivingSocial

This is a must-read for Rails developers looking to juice up their skills for a world
of web apps that increasingly includes mobile browsers and a lot more JavaScript.