# Attachment\_fu and with\_image on existing entries

**URL:** <https://www.ruby-forum.com/t/attachment-fu-and-with-image-on-existing-entries/133672>\
**Category:** Rails\
**Created:** [April 2, 2008, 2:12pm UTC](https://www.ruby-forum.com/t/attachment-fu-and-with-image-on-existing-entries/133672 "2008-04-02T14:12:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/47e85d/32.png) [@jonny](https://www.ruby-forum.com/u/jonny)\
**Post date:** [April 2, 2008, 2:12pm UTC](https://www.ruby-forum.com/t/attachment-fu-and-with-image-on-existing-entries/133672/1 "2008-04-02T14:12:38Z")

</div>

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.
