Expected Behavior
I am looking at migrating a project using ActiveModelSerializers following the JSON API spec over to this gem, and I'm searching for a generic way for this gem to resolve the correct serializer when given an ActiveRecord model. This is because the existing base controllers use this approach to find the correct serializer. I couldn't find anything in the documentation describing a way to do this.
E.g. is there a way I can call JSONAPI::SerializableResource.new(record, include: '**').as_json to resolve which serializer to use for a given record. All the examples in the docs suggest you need to manually specify the correct serializer.
Actual Behavior
Can't find any method doing this?
Steps to Reproduce the Problem
Specifications
- Version: 2.2.0
- Ruby version: 2.5.5
Expected Behavior
I am looking at migrating a project using ActiveModelSerializers following the JSON API spec over to this gem, and I'm searching for a generic way for this gem to resolve the correct serializer when given an ActiveRecord model. This is because the existing base controllers use this approach to find the correct serializer. I couldn't find anything in the documentation describing a way to do this.
E.g. is there a way I can call
JSONAPI::SerializableResource.new(record, include: '**').as_jsonto resolve which serializer to use for a given record. All the examples in the docs suggest you need to manually specify the correct serializer.Actual Behavior
Can't find any method doing this?
Steps to Reproduce the Problem
Specifications