This project is archived and is in readonly mode.
Hash with indifferent access reverse merge problem
-
DrMark
- Tag set to activesupport, bug, core_ext, patch
+1 This is rather unexpected behavior. Given that Ruby tries to do the least surprising thing, shouldn't we fix this?
-
Rodney Carvalho
+1 Yes, this caused me hours of frustration. Indifferent access should happen on both getting and setting.
-
Gregory Tomei
this does seem to be inconsistent with how the HashWithIndifferentAccess class is intended to work.
-
H@rlan Knight
+1 Agreed, this would be a serious improvement. The current behavior leads to difficult-to-trace bugs.
-
Noah Thorp
+1
-
Brad Folkens
+1 Just ran into this problem this morning with some failing tests - unexpected behavior
-
Brad Folkens
- Tag changed from activesupport, bug, core_ext, patch to activesupport, bug, core_ext, patch, verified
I have a slightly different take on this now, some of my tests on my app started failing with the previous patch.
This updated version seems to work for additional cases but for some reason I can't get the activesupport tests to break (proving this update works). The problem seems to occur in the full rails stack when it is more than just the simple case being merged.
Solution is to convert the hash passed into reverse_merge into HashWithIndifferentAccess first, then merge.
-
Dmitry Ratnikov
I have modified the second patch a bit further by re-using the underlying implementation of reverse_merge rather than dublicating it again.
-
Repository
- State changed from new to resolved
(from [aa57e66fec3a131f5d246b8950a2c3286f858b78]) Ensure HWIA#reverse_merge! retrurns HWIA [#421 state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...
