1
0
Fork 0

Add attribute ApplicationPolicy::Context#params

This commit is contained in:
Alex Kotov 2019-09-12 04:01:19 +05:00
parent cae534bc71
commit 5445ac9c6f
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
2 changed files with 12 additions and 2 deletions

View file

@ -24,6 +24,7 @@ private
def pundit_user
@pundit_user ||= ApplicationPolicy::Context.new(
account: current_account,
params: params,
)
end

View file

@ -50,6 +50,10 @@ private
context&.account
end
def params
context&.params
end
def restricted?
Rails.application.restricted?
end
@ -76,16 +80,21 @@ private
context&.account
end
def params
context&.params
end
def restricted?
Rails.application.restricted?
end
end
class Context
attr_reader :account
attr_reader :account, :params
def initialize(account:)
def initialize(account:, params:)
@account = account
@params = params
end
end
end