• Email
  • Favorite
  • Download
  • Embed
  • Private Content

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Advanced Views with Erector

by Alex Chaffee on Oct 03, 2009

  • 1,698 views

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 synta...

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 was given by Jeff Dean at RailsConf 2009. http://en.oreilly.com/rails2009/public/schedule/detail/8587

Accessibility

Categories

Tags

erb views ruby erector

Upload Details

Uploaded via SlideShare as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

Cancel

1 Embed 8

http://www.slideshare.net 8

Statistics

Favorites
0
Downloads
9
Comments
0
Embed Views
8
Views on SlideShare
1,690
Total Views
1,698
Post Comment
Edit your comment Cancel

Advanced Views with Erector — Presentation Transcript