Advanced Views with Erector

Jeff Dean (Pivotal Labs)
General
Location: Ballroom B
Average rating: ****.
(4.00, 14 ratings)

Erector is a Ruby gem that implements the “builder” pattern for HTML generation. It can save developers time by encouraging more advanced reuse in views via composition and inheritance, terse syntax, auto-closing tags and default HTML-escaping of all output. It can serve as an alternate view technology in Rails.

Using Erector makes it easier to refactor complex views by using standard refactoring techniques such as extracting methods. In ERB you can only accomplish this by helpers or partials, each of which lives in separate files. Since every Erector widget is a class, you can factor out duplication more easily than you can with helpers or partials.

Because views are just Ruby classes, Erector allows for inherited (nested) layouts by default. As a security measure, all output is HTML-escaped by default and all HTML elements are closed automatically.

This talk will involve a combination of live-coding and slides, and a sample app with all examples will be provided on Github.

Jeff Dean

Pivotal Labs

Jeff Dean is a software engineer with Pivotal Labs.

Comments on this page are now closed.

Comments

Picture of Conrad Taylor
Conrad Taylor
05/13/2009 4:30am PDT

Where can I find the slides for your talk? It sounds very interesting and I’m sorry that I didn’t make it. Thanks.

News and Coverage
co-presented by Ruby Central, Inc. O'Reilly
  • Engine Yard
  • Heroku
  • Sun Microsystems
  • Blue Box Group
  • New Relic

Sponsorship Opportunities

For information on exhibition and sponsorship opportunities at RailsConf, contact Yvonne Romaine at yromaine@oreilly.com.

Download the RailsConf Sponsor/Exhibitor Prospectus

Media Partner Opportunities

Download the Media & Promotional Partner Brochure (PDF) for information on trade opportunities with O'Reilly conferences or contact mediapartners@ oreilly.com

Program Ideas

Post your suggestions for speakers, topics, and activities on the RailsConf wiki or send an email to rails-idea@oreilly.com.

Press and Media

For media-related inquiries, contact Maureen Jennings at maureen@oreilly.com.

Contact Us

View a complete list of RailsConf 2009 contacts.