diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2013-06-18 14:16:33 +0530 |
---|---|---|
committer | Neeraj Singh <neerajdotname@gmail.com> | 2013-06-19 17:37:27 +0530 |
commit | 6fb5f6f3d69662cc55a086f84f9caaca3eec1515 (patch) | |
tree | 456acb189b768bfd8f176439f471fc642ec5e5c5 /activerecord/lib | |
parent | 615ad884579f416a7cfcd685a9aa9d124ab72a7a (diff) | |
download | rails-6fb5f6f3d69662cc55a086f84f9caaca3eec1515.tar.gz rails-6fb5f6f3d69662cc55a086f84f9caaca3eec1515.tar.bz2 rails-6fb5f6f3d69662cc55a086f84f9caaca3eec1515.zip |
log the sql that is actually sent to the database
If I have a query that produces sql
`WHERE "users"."name" = 'a b'` then in the log all the
whitespace is being squeezed. So the sql that is printed in the
log is `WHERE "users"."name" = 'a b'`.
This can be confusing. This commit fixes it by ensuring that
whitespace is not squeezed.
fixes #10982
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/log_subscriber.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/log_subscriber.rb b/activerecord/lib/active_record/log_subscriber.rb index 61e5c120df..0358a36b14 100644 --- a/activerecord/lib/active_record/log_subscriber.rb +++ b/activerecord/lib/active_record/log_subscriber.rb @@ -41,7 +41,7 @@ module ActiveRecord return if IGNORE_PAYLOAD_NAMES.include?(payload[:name]) name = "#{payload[:name]} (#{event.duration.round(1)}ms)" - sql = payload[:sql].squeeze(' ') + sql = payload[:sql] binds = nil unless (payload[:binds] || []).empty? |