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
Post a Comment