# Attachment\_fu and validations

**URL:** <https://www.ruby-forum.com/t/attachment-fu-and-validations/142221>\
**Category:** Rails\
**Created:** [July 4, 2008, 6:18pm UTC](https://www.ruby-forum.com/t/attachment-fu-and-validations/142221 "2008-07-04T18:18:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![arvias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ac91a4/32.png) [@arvias](https://www.ruby-forum.com/u/arvias)\
**Post date:** [July 4, 2008, 6:18pm UTC](https://www.ruby-forum.com/t/attachment-fu-and-validations/142221/1 "2008-07-04T18:18:31Z")

</div>

Hi

I have a model with the attachment\_fu data and two other fields (title  
and description).  
My form contains the three fields: title, description, and  
uploaded\_data.

When I submit a form with a valid uploaded file and invalid title or  
description the errors are displayed correctly, however the valid  
uploaded picture is also removed. Next the user has to select and  
upload the picture all over again.

Is there a way to avoid this and have the picture saved? So he can  
enter another picture just if he wants to change it.

–  
M.

---

<div class="post-metadata">

**Author:** ![arvias](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ac91a4/32.png) [@arvias](https://www.ruby-forum.com/u/arvias)\
**Post date:** [July 4, 2008, 7:32pm UTC](https://www.ruby-forum.com/t/attachment-fu-and-validations/142221/2 "2008-07-04T19:32:58Z")

</div>

If validations fail record will not be saved. That’s how it works. Also  
provide instructions for the user in the form to make them enter valid  
values.

On Fri, Jul 4, 2008 at 9:18 AM, Marcelo B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Is there a way to avoid this and have the picture saved? So he can  
> enter another picture just if he wants to change it.

–  
[http://www.rubyplus.org/](http://www.rubyplus.org/)  
Free Ruby and Rails Screencasts
