paper clip plugin (dleting attachments)

1 view
Skip to first unread message

Tony Mathew

unread,
Aug 26, 2010, 12:54:23 AM8/26/10
to rubyonra...@googlegroups.com
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
--
Posted via http://www.ruby-forum.com/.

rajeevsharma86

unread,
Aug 26, 2010, 1:07:24 AM8/26/10
to rubyonra...@googlegroups.com
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



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.




--
Thanks:
Rajeev sharma

Tony Mathew

unread,
Aug 26, 2010, 1:43:55 AM8/26/10
to rubyonra...@googlegroups.com
>> rubyonrails-ta...@googlegroups.com<rubyonrails-talk%2Bunsu...@googlegroups.com>

>> .
>> For more options, visit this group at
>> 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

Tony Mathew

unread,
Aug 26, 2010, 2:01:28 AM8/26/10
to rubyonra...@googlegroups.com

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?

Reply all
Reply to author
Forward
0 new messages