Add attribute ApplicationPolicy::Context#params
This commit is contained in:
parent
cae534bc71
commit
5445ac9c6f
2 changed files with 12 additions and 2 deletions
|
@ -24,6 +24,7 @@ private
|
|||
def pundit_user
|
||||
@pundit_user ||= ApplicationPolicy::Context.new(
|
||||
account: current_account,
|
||||
params: params,
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in a new issue