Hi everyone,
I’m just upgrading an app from acts_as_attachment to attachment_fu and have run into an issue using the with_image method on existing attachment records.
It worked fine in acts_as_attachment but in attachment_fu it simply does not work at all, ruby actually hangs. It’s not too surprising really, since internally a blank string has been passed to Magick::Image.read instead of an actual file to load. The with_image method assumes that a temporary file is present, which it would be when the uploaded data has just been assigned, but not when working with a previously saved record.
A little patch to the plugin can fix it but it doesn’t seem like the best solution:
def with_image(&block)
# Write out the temporary data if it is not present
if temp_data.nil?
self.temp_data = current_data
end
self.class.with_image(temp_path, &block)
end
Anybody else had this problem?
-Jonathan.