Sha256: 8e426965cd8a477798af6c2f9fac45476cd648d61d443361aec5c18c551b42f5

Contents?: true

Size: 627 Bytes

Versions: 2

Compression:

Stored size: 627 Bytes

Contents

# frozen_string_literal: true
# A monkey-patch for Action View `render :partial` that auto-decorates `locals` values.
module ActiveDecorator
  module Monkey
    module ActionView
      module PartialRenderer
        private

        def setup(*)
          super

          @locals.values.each do |v|
            ActiveDecorator::Decorator.instance.decorate v
          end if @locals
          ActiveDecorator::Decorator.instance.decorate @object if @object && (@object != nil)
          ActiveDecorator::Decorator.instance.decorate @collection unless @collection.blank?

          self
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_decorator-1.0.0 lib/active_decorator/monkey/action_view/partial_renderer.rb
active_decorator-0.9.0 lib/active_decorator/monkey/action_view/partial_renderer.rb