-
-
Save PerezIgnacio/8af85c58f0073abffce46091a28f3ff3 to your computer and use it in GitHub Desktop.
User example with callbacks
This file contains 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
class User < ApplicationRecord | |
after_create :send_to_crm, if :send_user_to_crm? | |
after_create :send_welcome_email, if -> { receive_email_notifications: true } | |
# ... | |
private | |
def send_to_crm | |
# ... | |
end | |
def send_user_to_crm? | |
# ... | |
end | |
def send_welcome_email | |
# ... | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment