@@ -15,7 +15,7 @@ module Formatters
1515 # @option options [JSONAPI::Resource] resource: it tells the formatter which resource
1616 # class to be used rather than use an infered one (default behaviour)
1717 #
18- # @option options [JSONAPI::Resource] source_resource : it tells the formatter that this response is from a related resource
18+ # @option options [JSONAPI::Resource] source : it tells the formatter that this response is from a related resource
1919 # and the result should be interpreted as a related resources response
2020 #
2121 # @option options [String, Symbol] relationship_type: it tells that the formatter which relationship the data is from
@@ -32,7 +32,7 @@ module Formatters
3232 # @api public
3333 def jsonapi_format ( object , options = { } )
3434 if object . is_a? ( Hash )
35- hash = object . with_indifferent_access
35+ hash = object . with_indifferent_access
3636 object = hash_to_active_record ( hash [ :data ] , options [ :model ] )
3737 end
3838 fix_custom_request_options ( object )
@@ -133,13 +133,20 @@ def build_response_document(object, options)
133133 #
134134 # @api private
135135 def build_collection_result ( object , options )
136- records = build_collection ( object , options )
136+ records = build_collection ( object , options )
137137 result_options = result_options ( object , options )
138138
139139 if related_resource_operation? ( options )
140- source_resource = turn_source_into_resource ( options [ :source ] )
140+ source_resource = turn_source_into_resource ( options [ :source ] )
141141 relationship_type = get_source_relationship ( options )
142- JSONAPI ::RelatedResourcesOperationResult . new ( :ok , source_resource , relationship_type , records , result_options )
142+
143+ JSONAPI ::RelatedResourcesOperationResult . new (
144+ :ok ,
145+ source_resource ,
146+ relationship_type ,
147+ records ,
148+ result_options
149+ )
143150 else
144151 JSONAPI ::ResourcesOperationResult . new ( :ok , records , result_options )
145152 end
0 commit comments