Open ramonlg opened 7 years ago
You might want to have a look at the docs on the Root key: https://github.com/rails-api/active_model_serializers/blob/0-10-stable/docs/general/serializers.md#root I believe you're getting this error because the JSON adapter is trying to add a root key based on the model name, which in your case is just a hash.
This solved the problem. Thank you.
so how do you solve this? @ramonlg
I'm working on an app, and I'm updating from the version
0.8.3
to0.10.5
. Before the update the errors were serialized like this:I managed to update to the recente version, and almost everything is ok. But I'm having some trouble when try to serialize Not Acceptable Error(406).
For example, if I try to access this url
http://localhost:3001/users.pdf
, instead of rendering error 406, it shows error 500, and I get this on console:Expected behavior
Actual behavior
Environment
ActiveModelSerializers Version: 0.10.5 Ruby Version: 2.1.5 Rails Version: 4.2.1.7
Output of
ruby -e "puts RUBY_DESCRIPTION"
:ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0]
OS Type & Version:
OSX Yosemite version 10.10.5
Gemfile
Gemfile.lock
api_responder.rb
errors_controller.rb
errors_serializer.rb
config/initializers/active_model_serializer.rb
And I have this line on my routes file: