lib/action_policy/behaviour.rb in action_policy-0.5.7 vs lib/action_policy/behaviour.rb in action_policy-0.6.0
- old
+ new
@@ -72,13 +72,11 @@
def authorization_rule_for(policy, rule)
policy.resolve_rule(rule)
end
def lookup_authorization_policy(record, **options) # :nodoc:
- record = implicit_authorization_target! if record == :__undef__
- raise ArgumentError, "Record must be specified" if record.nil?
-
- options[:context] && (options[:context] = authorization_context.merge(options[:context]))
+ record = implicit_authorization_target! if :__undef__ == record # rubocop:disable Style/YodaCondition See https://github.com/palkan/action_policy/pull/180
+ Kernel.raise ArgumentError, "Record must be specified" if record.nil?
policy_for(record: record, **options)
end
module ClassMethods # :nodoc: