module ActiveModel::Validations::Callbacks::ClassMethods
def after_validation(*args, &block)
def after_validation(*args, &block) options = args.extract_options! options[:prepend] = true options[:if] = Array.wrap(options[:if]) options[:if] << "!halted" options[:if] << "self.validation_context == :#{options[:on]}" if options[:on] set_callback(:validation, :after, *(args << options), &block) end
def before_validation(*args, &block)
def before_validation(*args, &block) options = args.extract_options! if options.is_a?(Hash) && options[:on] options[:if] = Array.wrap(options[:if]) options[:if] << "self.validation_context == :#{options[:on]}" end set_callback(:validation, :before, *(args << options), &block) end