Created
April 27, 2012 18:25
-
-
Save MikeSilvis/2511552 to your computer and use it in GitHub Desktop.
new_user_mailer
This file contains hidden or 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 NewUserEmailer | |
@queue = :emailer | |
def self.perform(user_id) | |
user = User.find(user_id) | |
mail(:to => user.email, :subject => "Welcome #{user.name}") | |
end | |
end |
This file contains hidden or 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
require 'resque/server' | |
uri = URI.parse(ENV["REDISTOGO_URL"]) | |
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password) |
This file contains hidden or 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
Dir["#{Rails.root}/app/jobs/*.rb"].each { |file| require file } | |
ENV["REDISTOGO_URL"] ||= 'redis://redistogo:[email protected]:9640/' | |
uri = URI.parse(ENV["REDISTOGO_URL"]) | |
Resque.redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password) | |
Resque.after_fork = Proc.new { ActiveRecord::Base.establish_connection } | |
#Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection } |
This file contains hidden or 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 sign_up_confirmation(user) | |
Resque.enqueue(NewUserEmailer, user.id) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What an amazing gist.