Skip to content

Instantly share code, notes, and snippets.

@GuilleLeopold
Created March 11, 2020 18:54
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 GuilleLeopold/f04e6d28017f6769e5aff94e2b002a45 to your computer and use it in GitHub Desktop.
Save GuilleLeopold/f04e6d28017f6769e5aff94e2b002a45 to your computer and use it in GitHub Desktop.
observer
module Payment
class UserCustomerObserver < ActiveRecord::Observer
observe User::Customer
attr_reader :customer
def after_update(customer)
customer.update!(payments: customer.payments + 1)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment