diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-07-04 11:38:07 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-07-04 11:42:00 +0900 |
commit | 99b4c4ccdbbfc54a9f5eb8809edae9392e4ab2ab (patch) | |
tree | ad7e50da9f35f49f60c4dd8f577be0223a0873ca /activerecord | |
parent | 4b29d9f1db0dd8fc95829cfefed0687242cfc12b (diff) | |
download | rails-99b4c4ccdbbfc54a9f5eb8809edae9392e4ab2ab.tar.gz rails-99b4c4ccdbbfc54a9f5eb8809edae9392e4ab2ab.tar.bz2 rails-99b4c4ccdbbfc54a9f5eb8809edae9392e4ab2ab.zip |
Add missing `attr_name.to_s` in `AttributeMutationTracker`
`attributes` (`values` in `LazyAttributeHash` in `AttributeSet`) has
string keys, not symbols.
Fixes #29665.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/attribute_mutation_tracker.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/attribute_mutation_tracker.rb b/activerecord/lib/active_record/attribute_mutation_tracker.rb index 4de993e169..a01a58f8a5 100644 --- a/activerecord/lib/active_record/attribute_mutation_tracker.rb +++ b/activerecord/lib/active_record/attribute_mutation_tracker.rb @@ -26,6 +26,7 @@ module ActiveRecord end def change_to_attribute(attr_name) + attr_name = attr_name.to_s if changed?(attr_name) [attributes[attr_name].original_value, attributes.fetch_value(attr_name)] end @@ -44,7 +45,7 @@ module ActiveRecord end def changed_in_place?(attr_name) - attributes[attr_name].changed_in_place? + attributes[attr_name.to_s].changed_in_place? end def forget_change(attr_name) @@ -54,7 +55,7 @@ module ActiveRecord end def original_value(attr_name) - attributes[attr_name].original_value + attributes[attr_name.to_s].original_value end def force_change(attr_name) |