Skip to content

uygars/rails_presenter_with_draper

 
 

Repository files navigation

Rails Presenter with Draper

This will become a collection for a talk about the presenter pattern in Rails and using the example of the gem Draper.

Overview

  1. Reception
  2. Introduce the presenter pattern
  3. Do it in theory
  4. Explain the benefits
  5. Show some view code of a normal Rails project
  6. Introduce the gem Draper
  7. Show how to add it to the project
  8. Clean up the view bit by bit
  9. Show off some fancy tricks
  10. Fast-forward to the clean view code
  11. End frontal presentation - start open talk
  12. Summarize the benefits
  13. Ask for experiences
  14. Start discussion about pros and cons
  15. Ask the crowd if they see benefits for testing
  16. Thank everybody

Goals

This gem makes it easy to apply the decorator pattern to domain models in a Rails application. This pattern gives you three wins:

  1. Replace most helpers with an object-oriented approach
  2. Filter data at the presentation level
  3. Enforce an interface between your controllers and view templates.

Where to go from here

Watch the RailsCasts

Ryan Bates has put together an excellent RailsCast on Draper based on the 0.8.0 release:

RailsCast #286

And he did a Pro RailsCast on implementing the presenter pattern from scratch: RailsCast #287

Check out the Interwebs

About

A talk about the presenter pattern in Rails and an introduction to the gem Draper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published