aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/counter_cache.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-01-02 06:08:22 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-01-02 06:08:22 +0900
commita8b44e4f4e06b5fdd89077c82586066d2e3b7830 (patch)
treea7a3830451daccf8816d17c72b98dc4b2bd261ae /activerecord/lib/active_record/counter_cache.rb
parent3e8fa248b194c221e931d646d3eceb59990e90eb (diff)
downloadrails-a8b44e4f4e06b5fdd89077c82586066d2e3b7830.tar.gz
rails-a8b44e4f4e06b5fdd89077c82586066d2e3b7830.tar.bz2
rails-a8b44e4f4e06b5fdd89077c82586066d2e3b7830.zip
`touch_time` should be type casted to respect the precision of the column
Diffstat (limited to 'activerecord/lib/active_record/counter_cache.rb')
-rw-r--r--activerecord/lib/active_record/counter_cache.rb4
1 files changed, 1 insertions, 3 deletions
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(", ")