I’m uploading a raw image into a blob column and noticed that unless
I overwrote the model attribute writer that Rails would try to load a
ruby object for the image instead of just the raw data. So in the
model I did this:
and things work fine (though I don’t really know what I’m doing) …
except if the user fails to select an image to upload, in which cases
I get an error:
undefined method "read" for string ""
Any ideas for avoiding this error message in these cases? It seems
like some kind of conditional wrapped around the write_attribute
command should work, probably some IO method that will test for the
ability to read a stream (am I working with a stream here?) … or
maybe there’s a better way to upload a raw image.