Skip to content
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

How to get the attribute key from the serializer ? #2363

Open
bsylvain opened this issue Nov 15, 2019 · 0 comments
Open

How to get the attribute key from the serializer ? #2363

bsylvain opened this issue Nov 15, 2019 · 0 comments

Comments

@bsylvain
Copy link

I want to fix this issue : #2250

To do so I need to ask to the serializer if an attribute has a key in the default serializer. From what I understand It should be done in https://github.com/rails-api/active_model_serializers/blob/0-10-stable/lib/active_model_serializers/adapter/json_api/error.rb

In the self.resource_errors method, it is possible to retrieve the default serializer with : ActiveModel::Serializer.serializer_for error_serializer.object

But I cannot manage to get the json Key for an attribute ou of the serializer. How can I do that ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant