Skip to content

Commit

Permalink
make the warning clear about the effect of using validates_associated…
Browse files Browse the repository at this point in the history
… on both sides on an association.
  • Loading branch information
vijaydev authored and fxn committed Aug 13, 2011
1 parent ad55b1a commit 7372e9a
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions activerecord/lib/active_record/validations/associated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7372e9a

Please sign in to comment.