class
v7.2.3 - Show latest stable - Superclass: Object

A container for responses available from the current controller for requests for different mime-types sent to a particular action.

The public controller methods `respond_to` may be called with a block that is used to define responses to different mime-types, e.g. for `respond_to` :

respond_to do |format|
  format.html
  format.xml { render xml: @people }
end

In this usage, the argument passed to the block (`format` above) is an instance of the ActionController::MimeResponds::Collector class. This object serves as a container in which available responses can be stored by calling any of the dynamically generated, mime-type-specific methods such as `html`, `xml` etc on the Collector. Each response is represented by a corresponding block if present.

A subsequent call to #negotiate_format(request) will enable the Collector to determine which specific mime-type it should respond with for the current request, with this response then being accessible by calling #response.

Included modules

  • AbstractController::Collector

Attributes

[RW]format

Files

  • actionpack/lib/action_controller/metal/mime_responds.rb