123456789_123456789_123456789_123456789_123456789_

Class: ActionController::Middleware

Relationships & Source Files
Namespace Children
Classes:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: ActionController::Metal
Defined in: actionpack/lib/action_controller/middleware.rb

Class Attribute Summary

Metal - Inherited

::AbstractController::Base - Inherited

.abstract?
.supports_path?

Returns true if the given controller is capable of rendering a path.

Class Method Summary

Metal - Inherited

.action

Returns a ::Rack endpoint for the given action name.

.call

Makes the controller a ::Rack endpoint that runs the action in the given env's action_dispatch.request.path_parameters key.

.controller_name

Returns the last part of the controller's name, underscored, without the ending Controller.

.middleware

Alias for middleware_stack.

.new,
.use

Pushes the given ::Rack middleware and its arguments to the bottom of the middleware stack.

::AbstractController::Base - Inherited

.abstract,
.abstract!

Define a controller as abstract.

.action_methods

A list of method names that should be considered actions.

.clear_action_methods!

action_methods are cached and there is sometimes need to refresh them.

.controller_path

Returns the full controller name, underscored, without the ending Controller.

.hidden_actions

The list of hidden actions.

.internal_methods

A list of all internal methods for a controller.

.method_added

Refresh the cached action_methods when a new action_method is added.

::ActiveSupport::DescendantsTracker - Extended

Instance Attribute Summary

Metal - Inherited

#content_type,
#content_type=

Basic implementations for content_type=, location=, and headers are provided to reduce the dependency on the RackDelegation module in Renderer and Redirector.

#env, #env=,
#headers

The details below can be overridden to support a specific Request and Response object.

#location, #location=, #middleware_stack, #middleware_stack?, #params, #params=,
#performed?

Tests if render or redirect has already happened.

#request

The details below can be overridden to support a specific Request and Response object.

#response

The details below can be overridden to support a specific Request and Response object.

#response_body=, #session, #status, #status=

::AbstractController::Base - Inherited

Instance Method Summary

Metal - Inherited

#controller_name

Delegates to the class' controller_name.

#url_for

Basic url_for that can be overridden for more robust functionality.

::AbstractController::Base - Inherited

#action_methods

Delegates to the class' #action_methods

#available_action?

Returns true if a method for the action is available and can be dispatched, false otherwise.

#controller_path

Delegates to the class' #controller_path

#process

Calls the action going through the entire action dispatch stack.

::ActiveSupport::Configurable - Included

#config

Reads and writes attributes from a configuration OrderedHash.

Constructor Details

.new(app) ⇒ Middleware

[ GitHub ]

  
# File 'actionpack/lib/action_controller/middleware.rb', line 17

def new(app)
  ActionMiddleware.new(self, app)
end

#initialize(app) ⇒ Middleware

[ GitHub ]

  
# File 'actionpack/lib/action_controller/middleware.rb', line 30

def initialize(app)
  super()
  @_app = app
end

Class Method Details

.build

Alias for Metal.new.

[ GitHub ]

  
# File 'actionpack/lib/action_controller/middleware.rb', line 15

alias build new

Instance Attribute Details

#app (rw)

[ GitHub ]

  
# File 'actionpack/lib/action_controller/middleware.rb', line 22

attr_internal :app

Instance Method Details

#index

[ GitHub ]

  
# File 'actionpack/lib/action_controller/middleware.rb', line 35

def index
  call(env)
end

#process(action)

[ GitHub ]

  
# File 'actionpack/lib/action_controller/middleware.rb', line 24

def process(action)
  response = super
  self.status, self.headers, self.response_body = response if response.is_a?(Array)
  response
end