# Paperclip - when validation fails, hold onto attachments

**URL:** <https://www.ruby-forum.com/t/paperclip-when-validation-fails-hold-onto-attachments/173868>\
**Category:** Rails\
**Created:** [August 17, 2009, 12:42pm UTC](https://www.ruby-forum.com/t/paperclip-when-validation-fails-hold-onto-attachments/173868 "2009-08-17T12:42:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [August 17, 2009, 12:42pm UTC](https://www.ruby-forum.com/t/paperclip-when-validation-fails-hold-onto-attachments/173868/1 "2009-08-17T12:42:51Z")

</div>

I’ve seen this with paperclip before I think, anyone know how to fix it?

When my validation fails the form is re-rendered with the validation  
error messages, all fine. However, the paperclip attachments that were  
previously attached get lost.

Thinking that others may have done something with this and grateful if  
anyone could share a solution.

Not really acceptable for users to see this behavior.

Thanks

BB.

---

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [September 18, 2009, 10:41am UTC](https://www.ruby-forum.com/t/paperclip-when-validation-fails-hold-onto-attachments/173868/2 "2009-09-18T10:41:07Z")

</div>

YES!

```
  logger.debug "=======\r"
  logger.debug @explonaut.portrait.valid?
  logger.debug @explonaut.portrait.save if

```

@explonaut.portrait.valid?  
logger.debug “=======\r”

=\>

@explonaut.portrait.save if @explonaut.portrait.valid?

---

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [September 18, 2009, 10:51am UTC](https://www.ruby-forum.com/t/paperclip-when-validation-fails-hold-onto-attachments/173868/3 "2009-09-18T10:51:05Z")

</div>

YEAH … same problem to me!

Do you find a solution?

I do find this \>

> <https://stackoverflow.com/questions/967835/with-rails-paperclip-gem-how-to-temporarily-save-the-uploaded-file-if-the-model>

\< … but I’m not really happy with that.

Best Regards

---

<div class="post-metadata">

**Author:** ![bingobob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e480ec/32.png) [@bingobob](https://www.ruby-forum.com/u/bingobob)\
**Post date:** [September 18, 2009, 11:53am UTC](https://www.ruby-forum.com/t/paperclip-when-validation-fails-hold-onto-attachments/173868/4 "2009-09-18T11:53:22Z")

</div>

I still have the problem - be nice to solve for my users.
