78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# File 'lib/jsonapi/acts_as_resource_controller.rb', line 78
def process_request
@response_document = create_response_document
unless &&
render_response_document
return
end
request_parser = JSONAPI::RequestParser.new(
params,
context: context,
key_formatter: key_formatter,
server_error_callbacks: (self.class.server_error_callbacks || []))
transactional = request_parser.transactional?
begin
process_operations(transactional) do
run_callbacks :process_operations do
request_parser.each(response_document) do |op|
op.options[:serializer] = resource_serializer_klass.new(
op.resource_klass,
include_directives: op.options[:include_directives],
fields: op.options[:fields],
base_url: base_url,
key_formatter: key_formatter,
route_formatter: route_formatter,
serialization_options: serialization_options,
controller: self
)
op.options[:cache_serializer_output] = !JSONAPI.configuration.resource_cache.nil?
process_operation(op)
end
end
if response_document.has_errors?
raise ActiveRecord::Rollback
end
end
rescue => e
handle_exceptions(e)
end
render_response_document
end
|