aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/log_subscriber.rb
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-01-08 01:28:23 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-01-08 08:59:41 -0200
commit77516a712b5f10d14727d807697272b4607db7bc (patch)
tree1ace3b63b589af24e17852a1261d7e7cfd96f891 /activerecord/lib/active_record/log_subscriber.rb
parentde21da5048e426955b61f99ae71d37d5a9178d68 (diff)
downloadrails-77516a712b5f10d14727d807697272b4607db7bc.tar.gz
rails-77516a712b5f10d14727d807697272b4607db7bc.tar.bz2
rails-77516a712b5f10d14727d807697272b4607db7bc.zip
Ignore binds payload with nil column in AR log subscriber
Some tests were raising the following error: Could not log "sql.active_record" event. NoMethodError: undefined method `type' for nil:NilClass` Due to the way binds were being logged, the column info was considered always present, but that is not true for some of the tests listed in the issue. Closes #8806.
Diffstat (limited to 'activerecord/lib/active_record/log_subscriber.rb')
-rw-r--r--activerecord/lib/active_record/log_subscriber.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/log_subscriber.rb b/activerecord/lib/active_record/log_subscriber.rb
index 2366a91bb5..c1ba524c84 100644
--- a/activerecord/lib/active_record/log_subscriber.rb
+++ b/activerecord/lib/active_record/log_subscriber.rb
@@ -21,13 +21,15 @@ module ActiveRecord
end
def render_bind(column, value)
- if column.type == :binary
- rendered_value = "<#{value.bytesize} bytes of binary data>"
+ if column
+ if column.binary?
+ value = "<#{value.bytesize} bytes of binary data>"
+ end
+
+ [column.name, value]
else
- rendered_value = value
+ [nil, value]
end
-
- [column.name, rendered_value]
end
def sql(event)