Class: Cuprum::Rails::Responders::Html::SingularResource

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

Overview

Defines default responses for a singular RESTful resource.

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

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) ⇒ SingularResource

Returns a new instance of SingularResource.



21
22
23
24
25
26
27
28
# File 'lib/cuprum/rails/responders/html/singular_resource.rb', line 21

def initialize(**options)
  super

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