Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove &. syntax for ruby < 2.3 compatability #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/pundit/resource.rb
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ def records(options = {})
warn_if_show_defined

context = options[:context]
context[:policy_used]&.call
context[:policy_used].try(:call)
Pundit.policy_scope!(context[:current_user], _model_class)
end

@@ -35,13 +35,15 @@ def warn_if_show_defined

def can(method)
run_callbacks :policy_authorize do
context[:policy_used]&.call
context[:policy_used].try(:call)
policy.public_send(method)
end
end

def current_user
context&.[](:current_user)
return unless context

context[:current_user]
end

def policy