1
0
Fork 0
mirror of https://github.com/varvet/pundit.git synced 2022-11-09 12:30:11 -05:00

fix policy_scope for empty active record relations

This commit is contained in:
Thomas Walpole 2015-03-27 10:10:11 -07:00
parent 2e3ccd4a4d
commit 46bb98d298
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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