-
-
Save kivanio/bc95160cf20bc9922a93b6f335213bce to your computer and use it in GitHub Desktop.
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 Customer < ActiveRecord::Base | |
has_one :auto_created, dependent: :destroy | |
def self.register(params) | |
new(params).tap do |customer| | |
customer.save! | |
customer.send_welcome_email | |
end | |
end | |
def self.auto_create(params) | |
new(params).tap do |customer| | |
customer.save! | |
end | |
end | |
def send_welcome_email | |
CustomerMailer.welcome_email(self).deliver | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment