Skip to content

Instantly share code, notes, and snippets.

@victorhazbunanuff
Created July 11, 2013 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save victorhazbunanuff/5978937 to your computer and use it in GitHub Desktop.
Save victorhazbunanuff/5978937 to your computer and use it in GitHub Desktop.
class AccountDeletionJob
@queue = :account_deletion
# Warning .perform will destroy an account from the database.
def self.perform(account_id)
account = Account.find(account_id)
if account
Account.transaction do
begin
account.destroy!
AccountAlertMailer.deletion_notification(account).deliver
AccountAlertMailer.deletion_notification_for_jonathan(account).deliver
rescue => e
account.errors.add(:account_deletion, e.message)
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment