This repository has been archived by the owner on Sep 18, 2021. It is now read-only.
Move Hash symbolize_keys/symbolize_keys! to a helper module. #90
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Just wanted to start a discussion/issue, figured out it'd be easier showing some code, hope that is OK.
The issue happens when trying to add twitter-text-rb as a dependency of an application where old activerecord (e.g. 2.3.18) is also a dependency (e.g. Rails 2 app).
activerecord 2, the
Hash
symbolize_keys method used to return a newHash
, andHashWithIndifferentAccess
relied on that behavior (it doesn't overwrite that method).With the current
lib/twitter-text/core_ext/hash
extension,HashWithIndifferentAccess#symbolize_keys
returns a newHashWithIndifferentAccess
instead, which can cause unexpected behavior (e.g.HashWithIndifferentAccess.new('test' => 1).symbolize_keys.each { |k, v| puts k; }
returns strings as keys instead of symbols).I know it's a corner case, but it'd be nice for people still stuck with old activerecord (~> 2.3.18) and/or old Rails (2).