Skip to content

Commit 2b5f250

Browse files
authored
Merge pull request #26 from richmolj/master
Remove Rails coupling
2 parents cd149c1 + d6437ec commit 2b5f250

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/jsonapi_compliable/deserializer.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def id
6565
# @return [Hash] the raw :attributes hash + +id+
6666
def attributes
6767
@attributes ||= raw_attributes.tap do |hash|
68-
hash.merge!(id: id) if id
68+
hash[:id] = id if id
6969
end
7070
end
7171

@@ -191,13 +191,14 @@ def process_relationship_datum(datum)
191191
attributes = included_object[:attributes] || {}
192192
attributes[:id] = datum[:id] if datum[:id]
193193
relationships = process_relationships(included_object[:relationships] || {})
194-
194+
method = datum[:method]
195+
method = method.to_sym if method
195196

196197
{
197198
meta: {
198199
jsonapi_type: datum[:type],
199200
temp_id: temp_id,
200-
method: datum[:method].try(:to_sym)
201+
method: method
201202
},
202203
attributes: attributes,
203204
relationships: relationships

0 commit comments

Comments
 (0)