#coding=utf-8
namespace :course do
  desc "course end"
  task :end => :environment do
    courses = Course.where("end_date < '#{Date.today}' and is_end = 0")
    courses.each do |course|
      course.update_attribute(:is_end, 1)
    end
  end
end