Class: Cuprum::Rails::Responders::HtmlResponder
- Inherits:
-
BaseResponder
- Object
- BaseResponder
- Cuprum::Rails::Responders::HtmlResponder
- Defined in:
- lib/cuprum/rails/responders/html_responder.rb
Overview
Provides a DSL for defining responses to HTML requests.
By default, responds to any successful result by rendering the template for the action name and passing the result value as assigned variables. For a failing result, redirects to either the show page or the index page for the resource, based on the resource’s defined #routes.
Direct Known Subclasses
Instance Attribute Summary
Attributes included from Matching
Attributes inherited from BaseResponder
#action_name, #controller, #controller_name, #request, #resource, #result
Instance Method Summary collapse
-
#call(result) ⇒ #call
Finds and calls the response clause that matches the given result.
-
#format ⇒ Symbol
The format of the responder.
Methods included from Actions
Methods included from Matching
Methods included from Cuprum::Rails::Responders::Html::Rendering
#head, #redirect_back, #redirect_to, #render
Methods inherited from BaseResponder
#initialize, #member_action?, #routes
Instance Method Details
#call(result) ⇒ #call
Finds and calls the response clause that matches the given result.
-
Checks for an exact match (the result status, value, and error all match) in the given matcher (if any), then the responder class, then each ancestor of the responder class in ascending order.
-
If a match is not found, checks for a partial match (the result status, and either the value or the error match) in the same order.
-
If there is still no match found, checks for a generic match (the result status matches, and the match clause does not specify either an error or a value.
-
If there is no matching response clause, raises an exception.
If the responder defines an action matcher that matches the given action name, that matcher is matched against the result before any match clauses defined directly on the responder.
|
# File 'lib/cuprum/rails/responders/html_responder.rb', line 57
|
#format ⇒ Symbol
Returns the format of the responder.
61 62 63 |
# File 'lib/cuprum/rails/responders/html_responder.rb', line 61 def format :html end |