From 9feda929409ab687befaed8d1c9878d94e955adc Mon Sep 17 00:00:00 2001
From: Brent Wheeldon & Nick Monje <pair+brent+nmonje@pivotallabs.com>
Date: Fri, 22 Jun 2012 12:09:48 -0400
Subject: AR has a subclass of AM:PresenceValidator.

This allows us to mark the parent object as invalid if all associated objects
in a presence validated association are marked for destruction.

See: https://github.com/rails/rails/issues/6812
---
 guides/source/active_record_validations_callbacks.textile | 2 ++
 1 file changed, 2 insertions(+)

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

diff --git a/guides/source/active_record_validations_callbacks.textile b/guides/source/active_record_validations_callbacks.textile
index f49d91fd3c..da3a96d84e 100644
--- a/guides/source/active_record_validations_callbacks.textile
+++ b/guides/source/active_record_validations_callbacks.textile
@@ -373,6 +373,8 @@ class LineItem < ActiveRecord::Base
 end
 </ruby>
 
+If you validate the presence of an object associated via a +has_one+ or +has_many+ relationship, it will check that the object is neither +blank?+ nor +marked_for_destruction?+.
+
 Since +false.blank?+ is true, if you want to validate the presence of a boolean field you should use <tt>validates :field_name, :inclusion => { :in => [true, false] }</tt>.
 
 The default error message is "_can't be empty_".
-- 
cgit v1.2.3

