What is the most DRY way to prevent deletion of a parent if children exist?

I assume it would be a 
before_destroy :check_that_no_child_exists

But an object might have several different types of children and we would 
ideally want to iterate through all the has_many's with just one command.

Is there an elegant way of doing this, and returning a helpful error 
message indicating which type of child exists?

I'm amazed that Rails still doesn't seem to have a default facility for 
this as its a very basic requirement.

Thanks,
Michael

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/hobousers/-/0Awm6SDGCM8J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to