File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
lib/active_model_serializers/adapter/json_api Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -7,9 +7,10 @@ eval_gemfile local_gemfile if File.readable?(local_gemfile)
77# Specify your gem's dependencies in active_model_serializers.gemspec
88gemspec
99
10- gem 'jsonapi-deserializable' , github : 'beauby/jsonapi-deserializable'
11- gem 'jsonapi-validations' , github : 'beauby/jsonapi-validations'
1210gem 'jsonapi' , github : 'beauby/jsonapi'
11+ gem 'jsonapi-deserializable' , github : 'beauby/jsonapi-deserializable' , branch : 'new-dsl'
12+ gem 'jsonapi-validations' , github : 'beauby/jsonapi-validations'
13+ gem 'jsonapi-rails' , github : 'beauby/jsonapi-rails' , branch : 'initial-implementation'
1314
1415version = ENV [ 'RAILS_VERSION' ] || '4.2'
1516
Original file line number Diff line number Diff line change 1- require 'jsonapi'
2- require 'jsonapi/deserializable '
1+ require 'jsonapi/parser '
2+ require 'jsonapi/rails '
33
44module ActiveModelSerializers
55 module Adapter
@@ -83,7 +83,9 @@ def parse!(document, options = {})
8383 # on invalid payloads.
8484 def parse ( document , options = { } )
8585 # TODO: change to jsonapi-ralis to have default conversion to flat hashes
86- JSONAPI ::Deserializable ::Resource . new ( document ) . to_h
86+ result = JSONAPI ::Rails ::DeserializableResource . new ( document , options : options ) . to_hash
87+ result = transform_keys ( result ) if options [ :key_transform ]
88+ result
8789 rescue JSONAPI ::Parser ::InvalidDocument => e
8890 return { } unless block_given?
8991 yield e
You can’t perform that action at this time.
0 commit comments