spree/spree — pull request #3759 by bikeath1337 (2013-09-24 00:16:03+00:00)
Title: Refactors models/spree/order#after_cancel for better delayed mailer support

Refactors `spree/order#after_cancel` to follow the patterns in place in `gem spree_auth_devise` and `gem devise`. Those designs allow the mailer logic to be easily configured with `gem delayed_job`.

With the patch I can do this:

```ruby
module Spree
Order.class_eval do

handle_asynchronously :send_cancel_email

end
end
````

Without the patch, I have to do something like this, which breaks forward compatibility:

```ruby
module Spree
Order.class_eval do

def after_cancel
shipments.each { |shipment| shipment.cancel! }

send_cancel_email
self.payment_state = 'credit_owed' unless shipped?
end

def send_cancel_email
OrderMailer.cancel_email(self.id).deliver
end

handle_asynchronously :send_cancel_email

end
end
````