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:
parent
2e3ccd4a4d
commit
46bb98d298
2 changed files with 2 additions and 2 deletions
|
@ -33,7 +33,7 @@ module Pundit
|
||||||
private
|
private
|
||||||
|
|
||||||
def find
|
def find
|
||||||
if object.blank?
|
if object.nil?
|
||||||
nil
|
nil
|
||||||
elsif object.respond_to?(:policy_class)
|
elsif object.respond_to?(:policy_class)
|
||||||
object.policy_class
|
object.policy_class
|
||||||
|
|
|
@ -39,7 +39,7 @@ describe Pundit do
|
||||||
expect(Pundit.policy_scope(user, Comment)).to eq Comment
|
expect(Pundit.policy_scope(user, Comment)).to eq Comment
|
||||||
end
|
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
|
expect(Pundit.policy_scope(user, comments_relation)).to eq comments_relation
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue