Module: DrySerialization::JsonapiSerializer
- Defined in:
- lib/dry_serialization/jsonapi_serializer.rb,
lib/generators/dry_serialization/jsonapi_serializer/install_generator.rb
Defined Under Namespace
Classes: InstallGenerator
Instance Method Summary collapse
Instance Method Details
#serialized_resource(resource, serializer, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/dry_serialization/jsonapi_serializer.rb', line 3 def serialized_resource(resource, serializer, = {}) if resource.is_a?(ActiveRecord::Relation) || resource.is_a?(Array) [:is_collection] = true else [:is_collection] = false end serializer.new(resource, ) end |