Module: Utopia::Controller::Respond
- Defined in:
- lib/utopia/controller/respond.rb
Overview
This controller layer provides a convenient way to respond to different requested content types. The order in which you add converters matters, as it determins how the incoming Accept: header is mapped, e.g. the first converter is also defined as matching the media range /.
Defined Under Namespace
Modules: ClassMethods, Converter, Passthrough Classes: Responder
Class Method Summary collapse
Instance Method Summary collapse
-
#process!(request, path) ⇒ Object
Invokes super.
Class Method Details
.prepended(base) ⇒ Object
28 29 30 |
# File 'lib/utopia/controller/respond.rb', line 28 def self.prepended(base) base.extend(ClassMethods) end |
Instance Method Details
#process!(request, path) ⇒ Object
Invokes super. If a response is generated, format it based on the Accept: header.
169 170 171 172 173 174 175 |
# File 'lib/utopia/controller/respond.rb', line 169 def process!(request, path) if response = super response = self.class.response_for(self, request, path, response) response end end |