From 593a09d3b9aea53be5e56006c1be140091674db7 Mon Sep 17 00:00:00 2001
From: Oliver Legg <oliver.legg@mac.com>
Date: Mon, 27 Feb 2012 22:15:01 +0000
Subject: Add brief summary of strict validations added in 3.2.

---
 .../source/active_record_validations_callbacks.textile     | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'railties/guides/source/active_record_validations_callbacks.textile')

diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile
index 72ac8d2db9..fc9a2ad30c 100644
--- a/railties/guides/source/active_record_validations_callbacks.textile
+++ b/railties/guides/source/active_record_validations_callbacks.textile
@@ -141,6 +141,20 @@ end
 
 +invalid?+ is simply the inverse of +valid?+. +invalid?+ triggers your validations, returning true if any errors were found in the object, and false otherwise.
 
+h4. Strict Validations
+
+Rails can also be specify strict validations. You can use the +:strict+ option to set that validation as strict. If an object fails a strict validation then an +ActiveModel::StrictValidationFailed+ error message is raised.
+
+<ruby>
+class Person < ActiveRecord::Base
+  validates :name, :presence => {:strict => true}
+end
+
+>> p = Person.new
+>> p.valid?
+=> ActiveModel::StrictValidationFailed: can't be blank
+</ruby>
+
 h4(#validations_overview-errors). +errors[]+
 
 To verify whether or not a particular attribute of an object is valid, you can use +errors[:attribute]+. It returns an array of all the errors for +:attribute+. If there are no errors on the specified attribute, an empty array is returned.
-- 
cgit v1.2.3

