ruby on rails - creating rake task to delete messages older than x days -


how should go creating rake task deleting messages older 30 days? have mailboxer gem.

i tried test doing:

desc "remove message older day" task :remove_old_notifications => :environment notification.delete_all ["created_at < ?", 1.day.ago] end 

however take action. have file inside /lib/tasks

you need put in notifications.rake file or (extension need .rake). after it'll visible in

rake -t  

output , you'll can run using

rake remove_old_notifications 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -