diff options
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/active_record_validations_callbacks.textile | 2 |
1 files changed, 2 insertions, 0 deletions
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_". |