From 79b87787213fe773f87ffb39c7a286ccaa5d4a1b Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Sat, 28 Jul 2012 14:24:56 -0500 Subject: add example to ActiveModel::StrictValidationFailed [ci skip] --- activemodel/lib/active_model/errors.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index 4ed3462e7e..6089cb8525 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -437,6 +437,19 @@ module ActiveModel # Raised when a validation cannot be corrected by end users and are considered # 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 end end -- cgit v1.2.3