-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'source' is missing when model errors are serialized #69
Comments
Thanks for bringing this up. Regarding Regarding the |
Thanks for your response. I will be thankful if you can show me how to add Thanks |
I'm trying to use it with For example:
@aamir-pk by the way, here's how to use the |
You don't need to use FYI I added a comment to this issue which may help #79 |
Thanks @JoeWoodward but unfortunately it didn't fix for me. I tried to register the mime type as you mentioned on the #79 issue but I don't think it was the case for me. Also, it looks like it is already registered here https://github.com/jsonapi-rb/jsonapi-rails/blob/master/lib/jsonapi/rails/railtie.rb#L35 I'm using Ember data and my frontend is always sending the correct content type: |
I had not noticed the railtie specified the mime type. Thanks for pointing that out |
I am also having some trouble with this, some attributes return source and some don't. I am using the deserializable_resource method. |
Hi,
When my model is invalid I render the response (from controller) like this:
render jsonapi_errors: activity.errors, status: :unprocessable_entity
It serializes the model error as following:
It has two issues: 1) 'source' value is missing, 2) The detail of the message shouldn't contain the source attribute. For example instead of 'Occurred at Future time is not allowed' it should be 'Future time is not allowed'.
Thanks
The text was updated successfully, but these errors were encountered: