-
-
Save kivanio/1a6ca5b74550466355d6e2b10f681c91 to your computer and use it in GitHub Desktop.
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
class Customer < ActiveRecord::Base | |
after_create :send_welcome_email, unless: :auto_registered? | |
has_one :auto_created, dependent: :destroy | |
private | |
def send_welcome_email | |
CustomerMailer.welcome_email(self).deliver | |
end | |
def auto_registered? | |
!auto_created.nil? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment