Decorate your instance variables before render
Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
.gitignore
Gemfile
README.md
defer_draper.gemspec
teste

README.md

defer_draper

Decorate your instance variables before render

Installation

gem 'defer_draper'

Usage

Add before_filter :decorate_all in controllers you want to decorate.It accepts regular filter options, as :only, :except, etc

before_filter :decorate_all, only: [:index, :show]

All instance variables (starting with @) that have a decorator will be decorated before they are avaiable in the view.

TODO

  • Add a option to select what variables to decorate
    • decorate_all exclude: [:foo, :bar] # decorates all except @foo and @bar
    • decorate_all include: [:foo] # decorates only @foo
  • RSpec