Skip to content

Instantly share code, notes, and snippets.

@jerry-tao
Created February 24, 2015 12:05
Show Gist options
  • Save jerry-tao/96d5950f8ab33061ee13 to your computer and use it in GitHub Desktop.
Save jerry-tao/96d5950f8ab33061ee13 to your computer and use it in GitHub Desktop.
class Order < ActiveRecord::Base
after_save :close_order, if :finished
private
def close_order
#Some works here
end
end
def finish
order.finish
order.save
end
def cancel
order.cancel # will set order.finished true
order.save
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment