# Paper clip plugin (dleting attachments)

**URL:** <https://www.ruby-forum.com/t/paper-clip-plugin-dleting-attachments/193886>\
**Category:** Rails\
**Created:** [August 26, 2010, 6:54am UTC](https://www.ruby-forum.com/t/paper-clip-plugin-dleting-attachments/193886 "2010-08-26T06:54:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![merc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f07891/32.png) [@merc](https://www.ruby-forum.com/u/merc)\
**Post date:** [August 26, 2010, 6:54am UTC](https://www.ruby-forum.com/t/paper-clip-plugin-dleting-attachments/193886/1 "2010-08-26T06:54:22Z")

</div>

Hi All,  
i created an application to upload image files using paper clip  
plugin,its working successfully,alsoi had a page which l;ists all  
the images uploaded by the user.also there is a delete button to delete  
the image from db by entering value in the deleted\_at fileld in  
database not removing that complete row( not from the attachments  
files(ie images folder)).but when i tried to delete an image its  
getting removed from the images folder under public,can any one  
suggest any method to avoid the image not getting deleted from the  
public folder

please help me

Thanks in advance,  
tony

---

<div class="post-metadata">

**Author:** ![merc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f07891/32.png) [@merc](https://www.ruby-forum.com/u/merc)\
**Post date:** [August 26, 2010, 7:08am UTC](https://www.ruby-forum.com/t/paper-clip-plugin-dleting-attachments/193886/2 "2010-08-26T07:08:17Z")

</div>

Try some thing like this  
invoke this kind of method when needs to delete picture

def delete\_photo  
@object= User.find(params[:id])  
@object.update\_attribute(:photo, nil)  
@object.save  
redirect\_to @object  
end

On Thu, Aug 26, 2010 at 10:24 AM, Tony M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> To post to this group, send email to removed\_email\_address@domain.invalid.  
> To unsubscribe from this group, send email to  
> removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> .  
> For more options, visit this group at  
> [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

–  
Thanks:  
Rajeev sharma

---

<div class="post-metadata">

**Author:** ![merc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f07891/32.png) [@merc](https://www.ruby-forum.com/u/merc)\
**Post date:** [August 26, 2010, 7:43am UTC](https://www.ruby-forum.com/t/paper-clip-plugin-dleting-attachments/193886/3 "2010-08-26T07:43:55Z")

</div>

rajeevsharma86 wrote:

> Try some thing like this  
> invoke this kind of method when needs to delete picture
> 
> def delete\_photo  
> @object= User.find(params[:id])  
> @object.update\_attribute(:photo, nil)  
> @object.save  
> redirect\_to @object  
> end
> 
> On Thu, Aug 26, 2010 at 10:24 AM, Tony M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > To post to this group, send email to removed\_email\_address@domain.invalid.  
> > To unsubscribe from this group, send email to  
> > removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> > .  
> > For more options, visit this group at  
> > [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).
> 
> –  
> Thanks:  
> Rajeev sharma  
> first of all thanks for the valiant effort and reply, but that didnt  
> works for me,bcos i told u that when i delete like that i am losing the  
> attached file from mu public/pictures folder.is there any possible way  
> to preevent that. i think something related to plugin.can any one  
> knows this?  
> Thanks n advance,  
> Tony

---

<div class="post-metadata">

**Author:** ![merc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f07891/32.png) [@merc](https://www.ruby-forum.com/u/merc)\
**Post date:** [August 26, 2010, 8:01am UTC](https://www.ruby-forum.com/t/paper-clip-plugin-dleting-attachments/193886/4 "2010-08-26T08:01:28Z")

</div>

sir actuallly the problem is in my model i am using has\_attached\_file,  
in its helper definition its deleting files from my public folder.so  
its getting deleted. is thre any methode to override that?
