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

API response bodies are empty when using active_model_serializers #715

Closed
dnlsandiego opened this issue Aug 28, 2016 · 1 comment
Closed

Comments

@dnlsandiego
Copy link

I have a Rails 5 app in API mode using this gem and active_model_serializers. devise_token_auth's controllers renders plain hashes as responses but neither of all the 3 adapters from active_model_serializers seem to be able to render the hashes to JSON.

Versions:
Rails 5. (--api mode)
active_model_serializers: 0.10.2
devise_token_auth: 0.1.37 (tried 0.1.39, still the same)

Expected behavior vs actual behavior

curl -i -X DELETE http://localhost:3000/v1/auth/sign_out

Expected response body:
{ success: false, errors: ['User was not found or was not logged in.'] }

Actual response (with the default active_model_serializer adapter):
{}

With the active_model_serializer :json_api adapter:
NoMethodError (undefined method read_attribute_for_serialization' for {:errors=>["User was not found or was not logged in."]}:Hash)`

With the active_model_serializer :json adapter:
NoMethodError (undefined methodmodel_name' for Hash:Class):`

I filled an issue over there rails-api/active_model_serializers#1893 as well. I've read some other issues here that imply most devise_token_auth users are using active_model_serializers as well. What is the proper configuration (if any) between both gems?

I can provide a repo that reproduces this issue if needed.

@dnlsandiego dnlsandiego changed the title API responses are empty when using active_model_serializers API response bodies are empty when using active_model_serializers Aug 28, 2016
@dnlsandiego
Copy link
Author

@lynndylanhurley Sorry to specifically tag you on this but I've been stuck on this issue for about almost a week. Any idea on what would be causing this?

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