Skip to content

Instantly share code, notes, and snippets.

@rafaellima
Created January 14, 2014 01:32
Show Gist options
  • Save rafaellima/8411524 to your computer and use it in GitHub Desktop.
Save rafaellima/8411524 to your computer and use it in GitHub Desktop.
Refactoring a user model that sends a e-mail.
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