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 def pundit_user
@pundit_user ||= ApplicationPolicy::Context.new( @pundit_user ||= ApplicationPolicy::Context.new(
account: current_account, account: current_account,
params: params,
) )
end end

View file

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