create rake task to remove preview bulletins

This commit is contained in:
EricTYL 2019-10-09 13:57:49 +08:00
parent 02e4df8b1f
commit 5382ccdd9e
1 changed files with 8 additions and 4 deletions

View File

@ -1,4 +1,8 @@
# desc "Explaining what the task does"
# task :bulletin do
# # Task goes here
# end
desc 'Remove duplicated bulletins (announcements) created by preview'
namespace :bulletin do
task :remove_preview_bulletins do
bulletins = Bulletin.where(is_preview: true)
bulletins.destroy_all
end
end