From 46bb98d2981d689f577116736fe950038c15d091 Mon Sep 17 00:00:00 2001 From: Thomas Walpole Date: Fri, 27 Mar 2015 10:10:11 -0700 Subject: [PATCH] fix policy_scope for empty active record relations --- lib/pundit/policy_finder.rb | 2 +- spec/pundit_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pundit/policy_finder.rb b/lib/pundit/policy_finder.rb index a3c4d42..8e2bfe8 100644 --- a/lib/pundit/policy_finder.rb +++ b/lib/pundit/policy_finder.rb @@ -33,7 +33,7 @@ module Pundit private def find - if object.blank? + if object.nil? nil elsif object.respond_to?(:policy_class) object.policy_class diff --git a/spec/pundit_spec.rb b/spec/pundit_spec.rb index bb09137..5f39728 100644 --- a/spec/pundit_spec.rb +++ b/spec/pundit_spec.rb @@ -39,7 +39,7 @@ describe Pundit do expect(Pundit.policy_scope(user, Comment)).to eq Comment end - it "returns an instantiated policy scope given an active record relation", focus: true do + it "returns an instantiated policy scope given an active record relation" do expect(Pundit.policy_scope(user, comments_relation)).to eq comments_relation end