Sha256: f37f6a6fcc0eeffcaa13c88a193f586f57c5eb10330161f4f557fcfb06baa4b6

Contents?: true

Size: 918 Bytes

Versions: 6

Compression:

Stored size: 918 Bytes

Contents

# wrap the action rendering for ActiveScaffold controllers
module ActiveScaffold
  module ActionController # :nodoc:
    def render(*args, &block)
      if self.class.uses_active_scaffold? && params[:adapter] && @rendering_adapter.nil? && request.xhr?
        @rendering_adapter = true # recursion control
        # if we need an adapter, then we render the actual stuff to a string and insert it into the adapter template
        opts = args.any? ? args.first : {}

        render partial: params[:adapter][1..],
               locals: {payload: render_to_string(opts.merge(layout: false), &block).html_safe}, # rubocop:disable Rails/OutputSafety
               use_full_path: true, layout: false, content_type: :html
        @rendering_adapter = nil # recursion control
      else
        super
      end
    end
  end
end

module ActionController
  class Base
    prepend ActiveScaffold::ActionController
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
active_scaffold-4.0.2 lib/active_scaffold/extensions/action_controller_rendering.rb
active_scaffold-4.0.1 lib/active_scaffold/extensions/action_controller_rendering.rb
active_scaffold-4.0.0 lib/active_scaffold/extensions/action_controller_rendering.rb
active_scaffold-4.0.0.rc3 lib/active_scaffold/extensions/action_controller_rendering.rb
active_scaffold-4.0.0.rc2 lib/active_scaffold/extensions/action_controller_rendering.rb
active_scaffold-4.0.0.rc1 lib/active_scaffold/extensions/action_controller_rendering.rb