How should I remove old photo files usinh whenever gem

12 views
Skip to first unread message

regedarek

unread,
Feb 7, 2012, 7:45:58 PM2/7/12
to rubyonra...@googlegroups.com
Hi.
My gems: carrierwave, whenever
I would like to remove from server photos uploaded 30 days ago.

I should use runner ?

every 1.day, :at => '4:30 am' do
  runner "MyPhotoModel.remove_after_30_days"
end

How to remove files .jpg from server using runner?

Should I remove records in photo table??
 

Walter Lee Davis

unread,
Feb 8, 2012, 12:33:42 PM2/8/12
to rubyonra...@googlegroups.com

I haven't used CarrierWave yet, but many of the other file attachment gems delete the underlying file when the the corresponding object is destroyed. Try this in console --

Photo.first.destroy

Then look in your file folder to see if the matching file is actually gone.

Walter

Reply all
Reply to author
Forward
0 new messages