This gem is intended to trim database logging of BLOBs. The implementation is originally made from this blog by Karol Bucek.

The gem has been updated and some bugs have been fixed along the way.


Currently it is working with Rails >= 3.2 and ruby version >= 1.9.

If you need this gem for another combination of versions, please create an issue specifying which version combination you are intereested in.


Add this line to your application's Gemfile:

gem 'trim_blobs'

And then execute:

$ bundle

Or install it yourself as:

$ gem install trim_blobs


There is basically no usage. The result of using this gem can be seen in the log files where long lines of hexadecimal number have been replaced with a text like

\x89504e470d0a1a0a0000000d49484452... (TRIMMED 34924 hexadecimal digits)


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request