From 6b4be999ee12dd494241794042cd97c27da2c586 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 22 Feb 2016 18:35:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=9A=84=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/resource_publish.rake | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lib/tasks/resource_publish.rake diff --git a/lib/tasks/resource_publish.rake b/lib/tasks/resource_publish.rake new file mode 100644 index 000000000..2df0c6145 --- /dev/null +++ b/lib/tasks/resource_publish.rake @@ -0,0 +1,11 @@ +#coding=utf-8 + +namespace :resource_publish do + desc "start publish resource" + task :publish => :environment do + attachments = Attachment.where("publish_time = '#{Date.today}'") + attachments.each do |attachment| + attachment.update_column('is_publish', 1) + end + end +end \ No newline at end of file