Adding watermarks to images with mini_magick error 256

Wednesday, April 8th, 2009
I was attempting to watermark an uploaded image using attachment_fu for uploads and the mini_magick gem for processing. I received an odd little error that Google doesn't seem to have many answers for. That error is Error 256. This is what I was doing: after_attachment_saved do |image| if image.thumbnail.nil? ...

Ruby snippet: Return a different string if empty or if replacing

Wednesday, December 24th, 2008
In my latest Rails project I needed a quick way to return a string if that string happened to be blank, and also a way to return a different string if the existing string is set. Here's the solution I came up with which I placed in extras.rb in my ...