Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

make the warning clear about the effect of using validates_associated…

… on both sides on an association.
  • Loading branch information...
commit 7372e9ae9a06e6b15e1a20bc69667bf44c79676c 1 parent ad55b1a
Vijay Dev vijaydev authored fxn committed
Showing with 1 addition and 9 deletions.
  1. +1 −9 activerecord/lib/active_record/validations/associated.rb
10 activerecord/lib/active_record/validations/associated.rb
@@ -17,15 +17,7 @@ module ClassMethods
# validates_associated :pages, :library
# end
- # Warning: If, after the above definition, you then wrote:
- #
- # class Page < ActiveRecord::Base
- # belongs_to :book
- #
- # validates_associated :book
- # end
- #
- # this would specify a circular dependency and cause infinite recursion.
+ # WARNING: This validation must not be used on both ends of an association. Doing so will lead to a circular dependency and cause infinite recursion.
# NOTE: This validation will not fail if the association hasn't been assigned. If you want to
# ensure that the association is both present and guaranteed to be valid, you also need to
Please sign in to comment.
Something went wrong with that request. Please try again.