Module: DecoratesBeforeRendering
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/decorates_before_rendering.rb,
lib/decorates_before_rendering/version.rb
Overview
Decorates the specified fields. For instance, if you have
class StuffController < ApplicationController
include DecoratesBeforeRendering
decorates :thing_1, :thing_2
end
You can also specify the decorator you wish to use for a particular instance variable:
class StuffController < ApplicationController
include DecoratesBeforeRendering
decorates :thing_1, :with => ThingListDecorator
decorates :thing_2
end
For Draper 1.0 and above, collection elements are no longer decorated with Decorator.decorate(collection), but with Decorator.decorate_collection(collection). Specify that you want to decorate a collection, and with what decorator, with this syntax:
class StuffController < ApplicationController
include DecoratesBeforeRendering
decorates_collection :things_1, :with => ThingListDecorator
end
Constant Summary collapse
- VERSION =
"0.0.3"
Instance Method Summary collapse
Instance Method Details
#render(*args) ⇒ Object
64 65 66 67 |
# File 'lib/decorates_before_rendering.rb', line 64 def render(*args) __decorate_ivars__ super(*args) end |