Skip to content

Commit db20605

Browse files
committed
tests pass
1 parent 6b1c9ee commit db20605

File tree

2 files changed

+1
-137
lines changed

2 files changed

+1
-137
lines changed

lib/active_model_serializers/adapter/json_api/deserialization.rb

+1-10
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ 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-
result = JSONAPI::Rails::DeserializableResource.new(document, options: options).to_hash
86+
result = JSONAPI::Deserializable::ActiveRecord.new(document, options: options).to_hash
8787
result = apply_options(result, options)
8888
result
8989
rescue JSONAPI::Parser::InvalidDocument => e
@@ -94,7 +94,6 @@ def parse(document, options = {})
9494
def apply_options(hash, options)
9595
hash = transform_keys(hash, options) if options[:key_transform]
9696
hash = hash.deep_symbolize_keys
97-
hash = filter_fields(hash, options)
9897
hash = rename_fields(hash, options)
9998
hash
10099
end
@@ -106,14 +105,6 @@ def transform_keys(hash, options)
106105
CaseTransform.send(transform, hash)
107106
end
108107

109-
# executes only
110-
# then except
111-
def filter_fields(hash, options)
112-
hash = hash.select { |k, v| options[:only].include?(k) } if options[:only]
113-
hash = hash.select { |k, v| !options[:except].include?(k) } if options[:except]
114-
hash
115-
end
116-
117108
def rename_fields(hash, options)
118109
return hash unless options[:keys]
119110

test/adapter/json_api/parse_test.rb

-127
This file was deleted.

0 commit comments

Comments
 (0)