Accessing your Application Classes (including models) in Rake Tasks
When writing Rake tasks, to get access to all classes (such as the User model in this example) in your app’s environment, you need to depend on the :environment task shown as follows: task :post_user => :environment do end_time = Time.new start_time = end_time – 60 #subtract 60 seconds until start_time > end_time start_time =…