lib/authlogic/session/callbacks.rb in authlogic-1.4.0 vs lib/authlogic/session/callbacks.rb in authlogic-1.4.1
- old
+ new
@@ -2,11 +2,11 @@
module Session
# = Callbacks
#
# Just like in ActiveRecord you have before_save, before_validation, etc. You have similar callbacks with Authlogic, see all callbacks below.
module Callbacks
- CALLBACKS = %w(before_create after_create before_destroy after_destroy before_find after_find before_save after_save before_update after_update before_validation after_validation)
+ CALLBACKS = %w(before_create after_create before_destroy after_destroy before_find after_find before_save after_save before_update after_update before_validation validate after_validation)
def self.included(base) #:nodoc:
[:destroy, :find_record, :save, :validate].each do |method|
base.send :alias_method_chain, method, :callbacks
end
@@ -75,9 +75,10 @@
# validate
# after_validation # only if errors.empty?
def validate_with_callbacks
run_callbacks(:before_validation)
validate_without_callbacks
+ run_callbacks(:validate)
run_callbacks(:after_validation) if errors.empty?
end
end
end
end
\ No newline at end of file