views:

52

answers:

1

I'm writing a Rails 2.3.8 application and appreciate the ActiveRecord default logging configuration in development mode which is to show the SQL queries and their values at the server console. But, in the case of blob values I would prefer not seeing them.

Is it possible to maintain the same logging level but without getting blobs content when insert statements are issued?

Thanks

+3  A: 

You can use filter_parameter_logging in your application controller to scrub that out, just as you would with passwords and password confirmations:

class ApplicationController < ActionController::Base
  filter_parameter_logging :my_blob
end

This is cumbersome if you have several different potential blob params, but works for most cases.

Dave Pirotte
That seems to be useful, but just for request parameters (like form passwords). I wonder how to do something similar when blobs are inserted to the database by ActiveRecord.
df