File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -294,11 +294,11 @@ def errors
294294 end
295295
296296 class ValidationErrors < Error
297- attr_reader :error_messages , :resource_associations
297+ attr_reader :error_messages , :resource_relationships
298298
299299 def initialize ( resource )
300300 @error_messages = resource . model . errors . messages
301- @resource_associations = resource . class . _associations . keys
301+ @resource_relationships = resource . class . _relationships . keys
302302 @key_formatter = JSONAPI . configuration . key_formatter
303303 end
304304
@@ -322,11 +322,11 @@ def json_api_error(attr_key, message)
322322 source : { pointer : pointer ( attr_key ) } )
323323 end
324324
325- def pointer ( attr_or_association_name )
326- if resource_associations . include? ( attr_or_association_name )
327- "/data/relationships/#{ attr_or_association_name } "
325+ def pointer ( attr_or_relationship_name )
326+ if resource_relationships . include? ( attr_or_relationship_name )
327+ "/data/relationships/#{ attr_or_relationship_name } "
328328 else
329- "/data/attributes/#{ attr_or_association_name } "
329+ "/data/attributes/#{ attr_or_relationship_name } "
330330 end
331331 end
332332 end
You can’t perform that action at this time.
0 commit comments