Module: Ocean::OceanResourceController
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/ocean/ocean_resource_controller.rb
Overview
This module is included in ActionController::Base. The most notable effect is that the class method ocean_resource_controller
becomes available, and that rescue_from handlers are added to handle exceptions for non-unique, stale, and invalid records. These all terminate the current action and return standard JSON API errors and validation errors. This allows POST
and PUT
actions to be written in a very terse, clear and understandable manner.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#extra_actions ⇒ Object
Used in controller code internals to obtain the extra actions declared using
ocean_resource_controller
. -
#missing_attributes? ⇒ Boolean
Returns true if the params hash lacks a required attribute declared using
ocean_resource_controller
.
Instance Method Details
#extra_actions ⇒ Object
Used in controller code internals to obtain the extra actions declared using ocean_resource_controller
.
110 111 112 |
# File 'lib/ocean/ocean_resource_controller.rb', line 110 def extra_actions self.class.ocean_resource_controller_extra_actions end |
#missing_attributes? ⇒ Boolean
Returns true if the params hash lacks a required attribute declared using ocean_resource_controller
.
119 120 121 122 123 124 |
# File 'lib/ocean/ocean_resource_controller.rb', line 119 def missing_attributes? self.class.ocean_resource_controller_required_attributes.each do |attr| return true unless params[attr] end return false end |