# How to validate composites?

**URL:** <https://www.ruby-forum.com/t/how-to-validate-composites/87462>\
**Category:** Rails\
**Created:** [March 2, 2007, 7:08pm UTC](https://www.ruby-forum.com/t/how-to-validate-composites/87462 "2007-03-02T19:08:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![suer\_rick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bc8723/32.png) [@suer\_rick](https://www.ruby-forum.com/u/suer_rick)\
**Post date:** [March 2, 2007, 7:08pm UTC](https://www.ruby-forum.com/t/how-to-validate-composites/87462/1 "2007-03-02T19:08:59Z")

</div>

Let’s take the example from AWDWR where a Customer object is compose\_of  
a Name object.

And let’s say that the lastname and firstname can not be null.

How would I use validates\_presence\_of ?

Would it be something like:

class Customer  
composed of :name, …  
validates\_presence\_of name.lastname, name.firstname  
end
