diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-12-14 13:44:01 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-12-14 13:44:01 -0800 |
commit | 99d142a9375f9ba1960863b3cc745265aa9a14df (patch) | |
tree | 97b24b00a8fb49c628c56789d1fec911d00756ce /activerecord/lib | |
parent | a8864aafe94530afd1266bac28e2a9e2bf454d82 (diff) | |
parent | 8f59ffce671c9b467b0f97b420305a9faa5214d8 (diff) | |
download | rails-99d142a9375f9ba1960863b3cc745265aa9a14df.tar.gz rails-99d142a9375f9ba1960863b3cc745265aa9a14df.tar.bz2 rails-99d142a9375f9ba1960863b3cc745265aa9a14df.zip |
Merge pull request #8514 from mmb/filter_blob
Do not log the binding values for binary columns.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/log_subscriber.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/log_subscriber.rb b/activerecord/lib/active_record/log_subscriber.rb index ca79950049..11ec2eaf79 100644 --- a/activerecord/lib/active_record/log_subscriber.rb +++ b/activerecord/lib/active_record/log_subscriber.rb @@ -20,6 +20,16 @@ module ActiveRecord @odd_or_even = false end + def render_bind(column, value) + if column.type == :binary + rendered_value = "<#{value.bytesize} bytes of binary data>" + else + rendered_value = value + end + + [column.name, rendered_value] + end + def sql(event) self.class.runtime += event.duration return unless logger.debug? @@ -34,7 +44,7 @@ module ActiveRecord unless (payload[:binds] || []).empty? binds = " " + payload[:binds].map { |col,v| - [col.name, v] + render_bind(col, v) }.inspect end |