Child to Parent Validation Errors

Hi:

Passing child virtual attribute validation error to parent…
in case of nested attributes.

So, I have a Parent Model say ‘Parent’.
Nested Attributes it accepts for Child say ‘Child’

Now suppose there is a validate method in ‘Child’

and it has something like self.errors.add_to_base(“some message”).

How do you make sure that Parent gets this?

I thought it will be auto copied to Parent as in other normal class
macros like validates_presence_of.

However, in this case I am loosing the message display from Child to
Parent for this error.

Is there a manual copy method for Child to Parent?

This is for a Virtual Attribute added in Child, but just doing
self.errors in Validate of Child, shouldn’t it be copied to Parent
directly?

Thanks for any clarifications here.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs