From ea5b7ae9d27d4addff847afb9d55448b1e8c15e4 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 9 Jun 2020 13:11:08 -0300 Subject: [PATCH] laburar con zeitwerk --- app/lib/pundit/nil_policy_error.rb | 6 ++++++ app/policies/nil_class_policy.rb | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 app/lib/pundit/nil_policy_error.rb diff --git a/app/lib/pundit/nil_policy_error.rb b/app/lib/pundit/nil_policy_error.rb new file mode 100644 index 00000000..d4e7e23f --- /dev/null +++ b/app/lib/pundit/nil_policy_error.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +# La excepción para capturar un recurso no encontrado y mostrar un 404 +module Pundit + class NilPolicyError < RuntimeError; end +end diff --git a/app/policies/nil_class_policy.rb b/app/policies/nil_class_policy.rb index ef848955..7d890c7f 100644 --- a/app/policies/nil_class_policy.rb +++ b/app/policies/nil_class_policy.rb @@ -6,8 +6,6 @@ # @see app/controllers/application_controller.rb # @see app/controllers/posts_controller.rb # @see app/controllers/site_controller.rb -class Pundit::NilPolicyError < RuntimeError; end - class NilClassPolicy def initialize(_, _) raise Pundit::NilPolicyError