Class: Cuprum::Rails::Responders::Html::PluralResource

Inherits:
Resource show all
Defined in:
lib/cuprum/rails/responders/html/plural_resource.rb

Overview

Defines default responses for a plural RESTful resource.

  • #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.

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 either the show page or the index page for the resource, based on the resource’s defined #routes.

Instance Attribute Summary

Attributes included from Matching

#matcher

Attributes inherited from BaseResponder

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

Instance Method Summary collapse

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

#call, #format

Methods included from Actions

#call, included

Methods included from Matching

#call, #format, #member_action?

Methods included from Rendering

#head, #redirect_back, #redirect_to, #render

Methods inherited from BaseResponder

#call, #member_action?, #routes

Constructor Details

#initialize(**options) ⇒ PluralResource

Returns a new instance of PluralResource.



23
24
25
26
27
28
29
30
# File 'lib/cuprum/rails/responders/html/plural_resource.rb', line 23

def initialize(**options)
  super

  SleepingKingStudios::Tools::CoreTools.deprecate(
    'Cuprum::Rails::Responders::Html::PluralResource',
    message: 'use Cuprum::Rails::Responders::Html::Resource'
  )
end