lib/pragma/operation/authorization.rb in pragma-operation-1.6.0 vs lib/pragma/operation/authorization.rb in pragma-operation-1.6.1
- old
+ new
@@ -66,12 +66,16 @@
else
build_policy(authorizable)
end
# rubocop:enable Metrics/LineLength
- params.each_pair do |name, value|
- next unless policy.resource.respond_to?("#{name}=")
- policy.resource.send("#{name}=", value)
+ if Object.const_defined?('Pragma::Contract::Base') && authorizable.is_a?(Pragma::Contract::Base)
+ authorizable.deserialize(params)
+ else
+ params.each_pair do |name, value|
+ next unless policy.resource.respond_to?("#{name}=")
+ policy.resource.send("#{name}=", value)
+ end
end
policy.send("#{self.class.operation_name}?").tap do |result|
after_authorization result
end