Created
January 14, 2014 01:32
-
-
Save rafaellima/8411524 to your computer and use it in GitHub Desktop.
Refactoring a user model that sends a e-mail.
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
def expire | |
Email.to self.email_address, :expiration | |
destroy | |
end | |
module Email | |
def self.to(email_address, template_name) | |
case template_name | |
when :expiration | |
ExpirationEmailWorker.perform_async(email_address) | |
# et cetera | |
end | |
end end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment