diff options
author | Dillon Welch <daw0328@gmail.com> | 2018-08-10 11:42:00 -0700 |
---|---|---|
committer | Dillon Welch <daw0328@gmail.com> | 2018-08-10 11:46:26 -0700 |
commit | 77c239e2c92309f96fe7f97b2cadeac2c4994ae0 (patch) | |
tree | 34be0cb9503fb739c1c3bba5189b5ee7ce355d3e /activerecord/lib/active_record | |
parent | 5f9f39eb9c99475706a322e368274a48dd15a1ff (diff) | |
download | rails-77c239e2c92309f96fe7f97b2cadeac2c4994ae0.tar.gz rails-77c239e2c92309f96fe7f97b2cadeac2c4994ae0.tar.bz2 rails-77c239e2c92309f96fe7f97b2cadeac2c4994ae0.zip |
Use strings instead of symbols on calls to decorate_matching_attribute_types
The first thing this method does is run on the argument. This change passes
in a string so we don't allocate a bunch of unnecessary extra strings by
calling to_s on a symbol over and over.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/locking/optimistic.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb index d2b7817b45..294a3dc32c 100644 --- a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb +++ b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb @@ -73,7 +73,7 @@ module ActiveRecord # `skip_time_zone_conversion_for_attributes` would not be picked up. subclass.class_eval do matcher = ->(name, type) { create_time_zone_conversion_attribute?(name, type) } - decorate_matching_attribute_types(matcher, :_time_zone_conversion) do |type| + decorate_matching_attribute_types(matcher, "_time_zone_conversion") do |type| TimeZoneConverter.new(type) end end diff --git a/activerecord/lib/active_record/locking/optimistic.rb b/activerecord/lib/active_record/locking/optimistic.rb index 7f096bb532..1030b2368b 100644 --- a/activerecord/lib/active_record/locking/optimistic.rb +++ b/activerecord/lib/active_record/locking/optimistic.rb @@ -165,7 +165,7 @@ module ActiveRecord def inherited(subclass) subclass.class_eval do is_lock_column = ->(name, _) { lock_optimistically && name == locking_column } - decorate_matching_attribute_types(is_lock_column, :_optimistic_locking) do |type| + decorate_matching_attribute_types(is_lock_column, "_optimistic_locking") do |type| LockingType.new(type) end end |