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)
7
7
# Specify your gem's dependencies in active_model_serializers.gemspec
8
8
gemspec
9
9
10
- gem 'jsonapi-deserializable' , github : 'beauby/jsonapi-deserializable'
11
- gem 'jsonapi-validations' , github : 'beauby/jsonapi-validations'
12
10
gem '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'
13
14
14
15
version = ENV [ 'RAILS_VERSION' ] || '4.2'
15
16
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 '
3
3
4
4
module ActiveModelSerializers
5
5
module Adapter
@@ -83,7 +83,9 @@ def parse!(document, options = {})
83
83
# on invalid payloads.
84
84
def parse ( document , options = { } )
85
85
# 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
87
89
rescue JSONAPI ::Parser ::InvalidDocument => e
88
90
return { } unless block_given?
89
91
yield e
You can’t perform that action at this time.
0 commit comments