Module: HumanError::VerifiableResource
- Defined in:
- lib/human_error/verifiable_resource.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/human_error/verifiable_resource.rb', line 19 def self.included(base) base.extend ClassMethods base.before_action except: %i{index create} do model = public_send(self.class.singular_resource_name) resource_not_found_error = HumanError.build( 'ResourceNotFoundError', resource_name: self.class.singular_resource_name, resource_id: [params[:id]], action: action_name, ) fail resource_not_found_error unless model.persisted? end end |