module ActiveModel::Validations::ClassMethods
def validates!(*attributes)
person.valid?
person.name = ''
person = Person.new
end
validates! :name, presence: true
attr_accessor :name
include ActiveModel::Validations
class Person
the validation itself.
when validation fails. See validates for more information about
ActiveModel::StrictValidationFailed instead of adding error
or :strict option set to true will always raise
users and are considered exceptional. So each validator defined with bang
This method is used to define validations that cannot be corrected by end
def validates!(*attributes) options = attributes.extract_options! options[:strict] = true validates(*(attributes << options)) end