Ruby On Rails: Ask for Confirmation When Table Entry Associated With Another Is Destroyed
        Posted  
        
            by 
                Train Main
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Train Main
        
        
        
        Published on 2010-12-22T04:51:00Z
        Indexed on 
            2010/12/22
            4:54 UTC
        
        
        Read the original article
        Hit count: 215
        
Hi all,
I would like some assistance with the following problem:
I have a table of groups that is self-associated with itself, so each group is (optionally) linked to another in a hierarchical fashion. I want to write some code that will somehow check before the destruction of a group entry, if it has any children, and ask the user for confirmation, or whether they wish to delete the child groups as well.
I've looked at callbacks, but I don't know how to get the confirmation request to the end user in the view, and then get the response back to the model's callback.
Thanks
© Stack Overflow or respective owner