Class: ActionController::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/active_scaffold/extensions/action_controller_rendering.rb,
lib/active_scaffold/extensions/action_controller_rescueing.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#deny_accessObject

adding to ActionController::Base so it can overrided in ApplicationController



4
5
6
# File 'lib/active_scaffold/extensions/action_controller_rescueing.rb', line 4

def deny_access
  head :forbidden # better for action or record not allowed, according to RFC 7231
end

#render_with_active_scaffold(*args, &block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/active_scaffold/extensions/action_controller_rendering.rb', line 4

def render_with_active_scaffold(*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.blank? ? {} : args.first
    render :partial => params[:adapter][1..-1],
           :locals => {:payload => render_to_string(opts.merge(:layout => false), &block).html_safe},
           :use_full_path => true, :layout => false, :content_type => :html
    @rendering_adapter = nil # recursion control
  else
    render_without_active_scaffold(*args, &block)
  end
end