module ActiveModel::Validations::Callbacks::ClassMethods
def after_validation(*args, &block)
person.valid? # => true
person.name = 'bob'
person.status # => false
person.valid? # => false
person.name = ''
person = Person.new
end
end
self.status = errors.empty?
def set_status
private
after_validation :set_status
validates_presence_of :name
attr_accessor :name, :status
include ActiveModel::Validations::Callbacks
include ActiveModel::Validations
class Person
Defines a callback that will get called right after validation.
def after_validation(*args, &block) options = args.extract_options! options = options.dup options[:prepend] = true set_options_for_callback(options) set_callback(:validation, :after, *args, options, &block) end