Permalink
Browse files

Merge pull request #387 from christophemaximin/fix_deprecated_string_…

…terminators

Fixed deprecated (by ActiveSupport 4.1.0) string terminators
  • Loading branch information...
2 parents abc0997 + 3ac6574 commit 4ac79c028d586cc644687ad57d7ca236b15bbc59 @binarylogic committed Feb 28, 2014
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/authlogic/session/callbacks.rb
@@ -63,8 +63,13 @@ module Callbacks
def self.included(base) #:nodoc:
base.send :include, ActiveSupport::Callbacks
- base.define_callbacks *METHODS + [{:terminator => 'result == false'}]
- base.define_callbacks *['persist', {:terminator => 'result == true'}]
+ if ActiveSupport::VERSION::STRING >= '4.1'
+ base.define_callbacks *METHODS + [{:terminator => ->(target, result){ result == false } }]
+ base.define_callbacks *['persist', {:terminator => ->(target, result){ result == false } }]
+ else
+ base.define_callbacks *METHODS + [{:terminator => 'result == false'}]
+ base.define_callbacks *['persist', {:terminator => 'result == true'}]
+ end
# If Rails 3, support the new callback syntax
if base.singleton_class.method_defined?(:set_callback)

0 comments on commit 4ac79c0

Please sign in to comment.