From a8b44e4f4e06b5fdd89077c82586066d2e3b7830 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Mon, 2 Jan 2017 06:08:22 +0900 Subject: `touch_time` should be type casted to respect the precision of the column --- activerecord/lib/active_record/counter_cache.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/counter_cache.rb b/activerecord/lib/active_record/counter_cache.rb index 020f4b872e..a0ef430683 100644 --- a/activerecord/lib/active_record/counter_cache.rb +++ b/activerecord/lib/active_record/counter_cache.rb @@ -106,9 +106,7 @@ module ActiveRecord if touch object = find(id) - touch_updates(object, touch).each do |column, touch_time| - updates << "#{connection.quote_column_name(column.to_s)} = #{connection.quote(touch_time)}" - end + updates << object.class.send(:sanitize_sql_for_assignment, touch_updates(object, touch)) end unscoped.where(primary_key => id).update_all updates.join(", ") -- cgit v1.2.3