# Validating New Record with Related Records

**URL:** <https://www.ruby-forum.com/t/validating-new-record-with-related-records/181163>\
**Category:** Rails\
**Created:** [January 6, 2010, 6:08pm UTC](https://www.ruby-forum.com/t/validating-new-record-with-related-records/181163 "2010-01-06T18:08:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikej](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a9a28c/32.png) [@mikej](https://www.ruby-forum.com/u/mikej)\
**Post date:** [January 6, 2010, 6:08pm UTC](https://www.ruby-forum.com/t/validating-new-record-with-related-records/181163/1 "2010-01-06T18:08:06Z")

</div>

I have a custom validation that validates a record by looking at  
related records. The problem is that until the record has been saved  
it has no id, therefore the relationships are not established. At the  
moment the validation works for updated records but not new ones.

Any idea on how to validate most efficiently in this circumstance?

Many thanks,

Mike
