Hi All,
Is anyone using validates_associated in a productive manner? What I mean is that I have not figured out how validates_associated is actually supposed to make life easier.
I have been playing with this a little but have not gotten much out if it. For example I have a Person model and an Activation model. In the Person model I have defined validates_associated :activations (Person has a 1..n with Activation)
When I do this for example after attempting person.save
<%= error_messages_for 'person' %>
and there is something invalid in an Activation instance associated with the person I simply get an error message (actually I get it twice, not sure why yet) stating that "Activations is invalid" rather than the specific error for the attribute which failed validation in the Activation instance. This is not very useful.
Alternatively I can of course validate the person instance and activation instance independantly and then dig out the error_messages_for for each instance but this is a little redundant.
Anyone have any good example or some good reading which discusses validates_associated in more detail?
Thanks, Serge