You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pgfqe6ch8/lib/tasks/resource_publish.rake

15 lines
600 B

#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 < '#{Time.now}' and is_publish = 0")
attachments.each do |attachment|
attachment.update_attributes(:is_publish => 1)
end
Rails.logger.info("log--------------------------------resource_publish end")
puts "--------------------------------resource_publish end"
end
end