Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Draper Gem

Draper Gem

A quick presentation at Montrealrb.com on how to use Draper gem to decorate views in a Ruby on Rails application.

Hugo Frappier

October 15, 2013
Tweet

More Decks by Hugo Frappier

Other Decks in Programming

Transcript

  1. # app/decorators/article_decorator.rb! class ArticleDecorator < Draper::Decorator! delegate_all! ! def publication_status!

    if published?! "Published at #{published_at}"! else! "Unpublished"! end! end! ! def published_at! object.published_at.strftime("%A, %B %e")! end! end!