mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
add example to ActiveModel::StrictValidationFailed [ci skip]
This commit is contained in:
parent
b8672914b7
commit
79b8778721
1 changed files with 13 additions and 0 deletions
|
@ -437,6 +437,19 @@ module ActiveModel
|
||||||
|
|
||||||
# Raised when a validation cannot be corrected by end users and are considered
|
# Raised when a validation cannot be corrected by end users and are considered
|
||||||
# exceptional.
|
# exceptional.
|
||||||
|
#
|
||||||
|
# class Person
|
||||||
|
# include ActiveModel::Validations
|
||||||
|
#
|
||||||
|
# attr_accessor :name
|
||||||
|
#
|
||||||
|
# validates_presence_of :name, strict: true
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# person = Person.new
|
||||||
|
# person.name = nil
|
||||||
|
# person.valid?
|
||||||
|
# # => ActiveModel::StrictValidationFailed: Name can't be blank
|
||||||
class StrictValidationFailed < StandardError
|
class StrictValidationFailed < StandardError
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue