From 9ddb4f66831c9db283736cabe66b10b9ab1eab93 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sun, 6 Sep 2015 16:38:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8C=BF=E5=90=8D=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=9C=A8=E7=BC=BA=E9=99=B7=E4=B8=AD=E7=9A=84=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20150906083453_delete_anonymous_jour.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 db/migrate/20150906083453_delete_anonymous_jour.rb diff --git a/db/migrate/20150906083453_delete_anonymous_jour.rb b/db/migrate/20150906083453_delete_anonymous_jour.rb new file mode 100644 index 000000000..5361eb5e1 --- /dev/null +++ b/db/migrate/20150906083453_delete_anonymous_jour.rb @@ -0,0 +1,15 @@ +class DeleteAnonymousJour < ActiveRecord::Migration + def up + jour_count = Journal.all.count / 30 + 2 + transaction do + for i in 1 ... jour_count do i + Journal.page(i).per(30).each do |jour| + jour.destroy if jour.user_id == 2 + end + end + end + end + + def down + end +end