Skip to content

Instantly share code, notes, and snippets.

@npj
Created June 3, 2012 11:39
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 npj/2863149 to your computer and use it in GitHub Desktop.
Save npj/2863149 to your computer and use it in GitHub Desktop.
# app/models/user.rb
class User
class << self
def async_spam_all(email_text)
Queue::Normal.enqueue(self, :spam_all, email_text)
end
def spam_all(email_text)
find_each { |user| UserMailer.spam(user, email_text).deliver }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment