Created
March 11, 2020 18:54
-
-
Save GuilleLeopold/f04e6d28017f6769e5aff94e2b002a45 to your computer and use it in GitHub Desktop.
observer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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