jsonapi-serializers: serialize_errors support claims for activelmodel are wrong
The problem is, the lib assumes that the errors hash is an activemodel hash if it responds to #to_hash and #full_messages. First there’s nowhere in the lint spec from activel model regarding these methods, so it’s a false assumption. Second, many objects implement #to_hash without arguments, and this gem assumes one hash argument with support for :full_messages key, which is also not part of the spec.
These assumptions make this gem fail for the sequel ORM, which is ActiveModel-compliant, has an errors object, but this doesn’t support #to_hash with arguments.
I think the lib should add suport explicitly for active record error hashes and fallback to something else.
About this issue
- Original URL
- State: open
- Created 8 years ago
- Comments: 15 (8 by maintainers)
@fotinakis yeah, out of the box AMS is not compatible with Sequel errors either. I made that tweak late last night and didn’t get around to submitting a PR because I ran into other issues with AMS and started looking elsewhere.