Skip to content

Commit

Permalink
Using alias_method to prevent errors
Browse files Browse the repository at this point in the history
This reverts commit 56af99d.

Conflicts:

	lib/delayed_job_mailer.rb
  • Loading branch information
andersondias committed Jan 4, 2010
1 parent 34bd98c commit cf6654b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/delayed_job_mailer.rb
Expand Up @@ -6,16 +6,19 @@ module Mailer
def self.included(base)
base.class_eval do
class << self
alias_method :orig_method_missing, :method_missing

def method_missing(method_symbol, *params)

if ::Delayed::Mailer.excluded_environments &&
::Delayed::Mailer.excluded_environments.include?(::RAILS_ENV.to_sym)
return super(method_symbol, *params)
return orig_method_missing(method_symbol, *params)
end

case method_symbol.id2name
when /^deliver_([_a-z]\w*)\!/ then super(method_symbol, *params)
when /^deliver_([_a-z]\w*)\!/ then orig_method_missing(method_symbol, *params)
when /^deliver_([_a-z]\w*)/ then self.send_later("#{method_symbol}!", *params)
else super(method_symbol, *params)
else orig_method_missing(method_symbol, *params)
end
end
end
Expand Down

0 comments on commit cf6654b

Please sign in to comment.