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.
上级 5f9f39eb
......@@ -73,7 +73,7 @@ def inherited(subclass)
# `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
......
......@@ -165,7 +165,7 @@ def update_counters(id, counters)
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册