Skip to content

Commit

Permalink
fix backwards compatibility for singleton_class calls
Browse files Browse the repository at this point in the history
  • Loading branch information
binarylogic committed May 26, 2010
1 parent ce0738b commit 73a6fb3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/authlogic/acts_as_authentic/password.rb
Expand Up @@ -182,7 +182,7 @@ def self.included(klass)
klass.define_callbacks *METHODS

# If Rails 3, support the new callback syntax
if klass.singleton_class.method_defined?(:set_callback)
if klass.send(klass.respond_to?(:singleton_class) ? :singleton_class : :metaclass).method_defined?(:set_callback)
METHODS.each do |method|
klass.class_eval <<-"end_eval", __FILE__, __LINE__
def self.#{method}(*methods, &block)
Expand Down
2 changes: 1 addition & 1 deletion lib/authlogic/session/callbacks.rb
Expand Up @@ -66,7 +66,7 @@ def self.included(base) #:nodoc:
base.define_callbacks *METHODS

# If Rails 3, support the new callback syntax
if base.singleton_class.method_defined?(:set_callback)
if base.send(base.respond_to?(:singleton_class) ? :singleton_class : :metaclass).method_defined?(:set_callback)
METHODS.each do |method|
base.class_eval <<-"end_eval", __FILE__, __LINE__
def self.#{method}(*methods, &block)
Expand Down

0 comments on commit 73a6fb3

Please sign in to comment.