Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

AM register_interceptor and register_observer only constantize if the…

… argument is a String
  • Loading branch information...
commit cb9e501a2893ec7e210a1de2550cb1ecf16d5c90 1 parent d907f3c
@joshk joshk authored josevalim committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 actionmailer/lib/action_mailer/base.rb
View
4 actionmailer/lib/action_mailer/base.rb
@@ -375,7 +375,7 @@ def register_interceptors(*interceptors)
# Either a class or a string can be passed in as the Observer. If a string is passed in
# it will be <tt>constantize</tt>d.
def register_observer(observer)
- delivery_observer = (observer.respond_to?(:delivered_email) ? observer : observer.constantize)
+ delivery_observer = (observer.is_a?(String) ? observer.constantize : observer)
Mail.register_observer(delivery_observer)
end
@@ -383,7 +383,7 @@ def register_observer(observer)
# Either a class or a string can be passed in as the Observer. If a string is passed in
# it will be <tt>constantize</tt>d.
def register_interceptor(interceptor)
- delivery_interceptor = (interceptor.respond_to?(:delivering_email) ? interceptor : interceptor.constantize)
+ delivery_interceptor = (interceptor.is_a?(String) ? interceptor.constantize : interceptor)
Mail.register_interceptor(delivery_interceptor)
end
Please sign in to comment.
Something went wrong with that request. Please try again.