Class: Cuprum::Rails::Responders::Html::Resource

Inherits:
Cuprum::Rails::Responders::HtmlResponder show all
Defined in:
lib/cuprum/rails/responders/html/resource.rb

Overview

Defines default responses for a RESTful resource.

If the resource is plural:

  • #create failure: renders the :new template.

  • #create success: redirects to the resource #show page.

  • #destroy success: redirects to the resource #index page.

  • #index failure: redirects to the root path.

  • #update failure: renders the :edit template.

  • #update success: redirects to the resource #show page.

If the resource is singular:

  • #create failure: renders the :new template.

  • #create success: redirects to the resource #show page.

  • #destroy success: redirects to the parent resource.

  • #update failure: renders the :edit template.

  • #update success: redirects to the resource #show page.

Responds to any other successful result by rendering the template for the action name and passing the result value as assigned variables. For a failing result, redirects to the parent resource (for a singular resource), or redirects to either the show page or the index page for the resource.

Direct Known Subclasses

PluralResource, SingularResource

Instance Attribute Summary

Attributes included from Matching

#matcher

Attributes inherited from BaseResponder

#action_name, #controller, #controller_name, #request, #resource, #result

Method Summary

Methods inherited from Cuprum::Rails::Responders::HtmlResponder

#call, #format

Methods included from Actions

#call, included

Methods included from Matching

#call, #format, #initialize, #member_action?

Methods included from Rendering

#head, #redirect_back, #redirect_to, #render

Methods inherited from BaseResponder

#call, #initialize, #member_action?, #routes