jsonapi-rb / jsonapi-rails

Rails gem for fast jsonapi-compliant APIs.
http://jsonapi-rb.org
MIT License
319 stars 63 forks source link

Take the guesswork out of resolving missing serializer errors? #91

Closed MrLeebo closed 2 years ago

MrLeebo commented 6 years ago

If you misconfigure your class option, you're greeted with undefined method 'new' for nil:NilClass. I understand why this error occurs, but for a complex graph, it can be difficult to figure out which serializer it tried to construct.

Seems like it would be possible to print the expected name of the class in the error message like instead:

Invalid serializer [SerializableUser]
JoeWoodward commented 6 years ago

This issue is actually related to https://github.com/jsonapi-rb/jsonapi-serializable/blob/master/lib/jsonapi/serializable.rb and as you can see has already been fixed. The jsonapi-rails gem hasn't been updated yet