# Models -- Validation of Graph Characteristics

**URL:** <https://www.ruby-forum.com/t/models-validation-of-graph-characteristics/120312>\
**Category:** Rails\
**Created:** [November 15, 2007, 6:43pm UTC](https://www.ruby-forum.com/t/models-validation-of-graph-characteristics/120312 "2007-11-15T18:43:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dscaffold](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f0a364/32.png) [@dscaffold](https://www.ruby-forum.com/u/dscaffold)\
**Post date:** [November 15, 2007, 6:43pm UTC](https://www.ruby-forum.com/t/models-validation-of-graph-characteristics/120312/1 "2007-11-15T18:43:10Z")

</div>

In 0.9, where do you validate such graph-related constraints as, for  
example, an added or changed relationship must not form a loop, or  
must not add a root? The caller could have commanded the change by  
calling a relationship assignment method, e. g., parent=, or by adding  
to a collection proxy, e, g., foo.children \<\< bar. In a case like  
that, should foo.children and bar.parent both have validators slapped  
onto them? And how do the validators cope with the possible  
discrepancies between what the cache says and what the database says?  
The cache doesn’t even seem maintain consistency with itself in the  
face of changes when it comes to the reciprocal acknowledgement of  
relationships. How do the validators cope with the possible self  
inconsistency of the cache?
