#coding=utf-8

namespace :resource_publish do
  desc "start publish resource"
  task :publish => :environment do
    Rails.logger.info("log--------------------------------resource_publish start")
    attachments = Attachment.where("publish_time < '#{Time.now}' and is_publish = 0")
    attachments.update_all(is_publish: 1)
    Rails.logger.info("log--------------------------------resource_publish end")
  end
end