How to validate composites?


#1

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