You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The spec allows an error object to contain fields such as title, detail etc. However it only seems that the title field in added in and the rest ignored. Can the save method be modified to add in all the other fields as well? ( especially since the json_api adapter for ActiveModel::Serializers serializes errors with a source and detail field instead of a title field )
defsavereturnfalseunlessvalid?self.last_result_set=ifpersisted?self.class.requestor.update(self)elseself.class.requestor.create(self)endiflast_result_set.has_errors?last_result_set.errors.eachdo |error|
iferror.source_parametererrors.add(error.source_parameter,error.detail)iferror.detailerrors.add(error.source_parameter,error.title)iferror.title#... check for other fields specified in the spec elseerrors.add(:base,error.detail)endendfalseelseerrors.cleariferrorsmark_as_persisted!ifupdated=last_result_set.firstself.attributes=updated.attributesrelationships.attributes=updated.relationships.attributesclear_changes_informationendtrueendend
The text was updated successfully, but these errors were encountered:
The spec allows an error object to contain fields such as
title
,detail
etc. However it only seems that thetitle
field in added in and the rest ignored. Can thesave
method be modified to add in all the other fields as well? ( especially since thejson_api
adapter forActiveModel::Serializers
serializes errors with asource
anddetail
field instead of atitle
field )The text was updated successfully, but these errors were encountered: