lib/pragma/macro/policy.rb in pragma-2.3.0 vs lib/pragma/macro/policy.rb in pragma-2.4.0

- old
+ new

@@ -8,10 +8,13 @@ end module Policy class << self def for(input, name, options, action = nil) - policy = options["policy.#{name}.class"].new(options['current_user'], options['model']) + policy = options["policy.#{name}.class"].new( + options['policy.context'] || options['current_user'], + options['model'] + ) action_name = action.is_a?(Proc) ? action.call(options) : action action_name ||= input.class.operation_name options["result.policy.#{name}"] = Trailblazer::Operation::Result.new(