mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Restore HWIA#stringify_keys! and update changelog
This commit is contained in:
parent
ebf9820f7e
commit
d692e6be30
4 changed files with 8 additions and 7 deletions
|
@ -1844,8 +1844,7 @@ module ActiveRecord #:nodoc:
|
|||
# user.is_admin? # => true
|
||||
def attributes=(new_attributes, guard_protected_attributes = true)
|
||||
return if new_attributes.nil?
|
||||
attributes = new_attributes.dup
|
||||
attributes.stringify_keys!
|
||||
attributes = new_attributes.stringify_keys
|
||||
|
||||
multi_parameter_attributes = []
|
||||
attributes = remove_attributes_protected_from_mass_assignment(attributes) if guard_protected_attributes
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
*Rails 3.0.0 [beta 3] (April 13th, 2010)*
|
||||
|
||||
* HashWithIndifferentAccess: remove inherited symbolize_keys! since its keys are always strings. [Santiago Pastorino]
|
||||
|
||||
* Improve transliteration quality. #4374 [Norman Clarke]
|
||||
|
||||
* Speed up and add Ruby 1.9 support for ActiveSupport::Multibyte::Chars#tidy_bytes. #4350 [Norman Clarke]
|
||||
|
|
|
@ -111,8 +111,8 @@ module ActiveSupport
|
|||
super(convert_key(key))
|
||||
end
|
||||
|
||||
undef :stringify_keys!
|
||||
def stringify_keys; to_hash.stringify_keys end
|
||||
def stringify_keys!; self end
|
||||
def stringify_keys; to_hash end
|
||||
undef :symbolize_keys!
|
||||
def symbolize_keys; to_hash.symbolize_keys end
|
||||
def to_options!; self end
|
||||
|
|
|
@ -89,9 +89,9 @@ class HashExtTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_stringify_keys_bang_for_hash_with_indifferent_access
|
||||
assert_raise(NoMethodError) { @symbols.with_indifferent_access.dup.stringify_keys! }
|
||||
assert_raise(NoMethodError) { @strings.with_indifferent_access.dup.stringify_keys! }
|
||||
assert_raise(NoMethodError) { @mixed.with_indifferent_access.dup.stringify_keys! }
|
||||
assert_equal @strings, @symbols.with_indifferent_access.dup.stringify_keys!
|
||||
assert_equal @strings, @strings.with_indifferent_access.dup.stringify_keys!
|
||||
assert_equal @strings, @mixed.with_indifferent_access.dup.stringify_keys!
|
||||
end
|
||||
|
||||
def test_indifferent_assorted
|
||||
|
|
Loading…
Reference in a new issue