#coding=utf-8 namespace :resource_publish do desc "start publish resource" task :publish => :environment do puts "--------------------------------resource_publish start" Rails.logger.info("log--------------------------------resource_publish start") attachments = Attachment.where("publish_time = '#{Date.today}'") attachments.each do |attachment| attachment.update_column('is_publish', 1) end Rails.logger.info("log--------------------------------resource_publish end") puts "--------------------------------resource_publish end" end end