File tree Expand file tree Collapse file tree 4 files changed +8
-5
lines changed Expand file tree Collapse file tree 4 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 22
33## Unreleased
44
5+ - (#386 )[ https://github.com/JsonApiClient/json_api_client/pull/386 ] - use HashWithIndifferentAccess
6+
57## 1.18.0
68- [ #372 ] ( https://github.com/JsonApiClient/json_api_client/pull/372 ) - Fix handling of dashed-types associations correctly
79
Original file line number Diff line number Diff line change @@ -67,11 +67,11 @@ def last
6767 end
6868
6969 def build ( attrs = { } )
70- klass . new @path_params . merge ( attrs . symbolize_keys )
70+ klass . new @path_params . merge ( attrs . with_indifferent_access )
7171 end
7272
7373 def create ( attrs = { } )
74- klass . create @path_params . merge ( attrs . symbolize_keys )
74+ klass . create @path_params . merge ( attrs . with_indifferent_access )
7575 end
7676
7777 def params
Original file line number Diff line number Diff line change @@ -348,7 +348,7 @@ def _build_connection(rebuild = false)
348348 #
349349 # @param params [Hash] Attributes, links, and relationships
350350 def initialize ( params = { } )
351- params = params . symbolize_keys
351+ params = params . with_indifferent_access
352352 @persisted = nil
353353 @destroyed = nil
354354 self . links = self . class . linker . new ( params . delete ( :links ) || { } )
@@ -538,7 +538,7 @@ def reset_request_select!(*resource_types)
538538 end
539539
540540 def path_attributes
541- _belongs_to_params . merge attributes . slice ( self . class . primary_key ) . symbolize_keys
541+ _belongs_to_params . merge attributes . slice ( self . class . primary_key ) . with_indifferent_access
542542 end
543543
544544 protected
Original file line number Diff line number Diff line change @@ -308,7 +308,8 @@ def test_build_propagate_only_path_params
308308 query = ArticleNested . where ( author_id : '123' , name : 'John' )
309309 record = query . build
310310 assert_equal [ ] , record . changed
311- assert_equal ( { author_id : '123' } , record . __belongs_to_params )
311+ assert_equal ( record . __belongs_to_params [ :author_id ] , '123' )
312+ assert_equal ( record . __belongs_to_params [ 'author_id' ] , '123' )
312313 assert_equal '123' , record . author_id
313314 assert_equal [ ] , record . relationships . changed
314315 end
You can’t perform that action at this time.
0 commit comments