Sha256: 3e0a0f48910c2f6c5142fa7ee778d855792d783e146d37c5c550063b60cbc2a3

Contents?: true

Size: 1002 Bytes

Versions: 8

Compression:

Stored size: 1002 Bytes

Contents

module ActiveDecorator
  module ActionViewExtension
    def setup_decorator
      @locals.values.each do |v|
        ActiveDecorator::Decorator.instance.decorate v
      end unless @locals.blank?
      ActiveDecorator::Decorator.instance.decorate @object unless @object.blank?
      ActiveDecorator::Decorator.instance.decorate @collection unless @collection.blank?

      self
    end
  end
end

if ActionPack::VERSION::STRING >= '3.1'
  class ActionView::PartialRenderer
    include ActiveDecorator::ActionViewExtension

    def setup_with_decorator(context, options, block) #:nodoc:
      setup_without_decorator context, options, block
      setup_decorator
    end

    alias_method_chain :setup, :decorator
  end
else
  class ActionView::Partials::PartialRenderer
    include ActiveDecorator::ActionViewExtension

    def setup_with_decorator(options, block) #:nodoc:
      setup_without_decorator options, block
      setup_decorator
    end

    alias_method_chain :setup, :decorator
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
active_decorator-0.5.3 lib/active_decorator/monkey/action_view/partial_renderer.rb
active_decorator-0.5.2 lib/active_decorator/monkey/action_view/partial_renderer.rb
active_decorator-0.5.1 lib/active_decorator/monkey/action_view/partial_renderer.rb
active_decorator-0.5.0 lib/active_decorator/monkey/action_view/partial_renderer.rb
active_decorator-0.4.0 lib/active_decorator/monkey/action_view/partial_renderer.rb
active_decorator-0.3.4 lib/active_decorator/monkey/action_view/partial_renderer.rb
active_decorator-0.3.3 lib/active_decorator/monkey/action_view/partial_renderer.rb
active_decorator-0.3.2 lib/active_decorator/monkey/action_view/partial_renderer.rb