Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@tomash
Created August 28, 2013 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomash/6363518 to your computer and use it in GitHub Desktop.
Save tomash/6363518 to your computer and use it in GitHub Desktop.
namespace :orders do
desc "make orders abandoned for a few days as cancelled"
task :cleanup => :environment do
Order.abandoned_but_not_marked.each do |order|
begin
order.cancellation_code = "abandoned"
order.save!
rescue => e
$stderr.puts "Could not mark as cancelled and save! order ##{order.id}"
$stderr.puts e.message
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment