I have several ActiveRecord objects with associations marked as dependent: :destroy . When a user deletes one of these objects, I want to present him with a list of all objects that will be (recursively) deleted. How to get this list?
dependent: :destroy
I found the affected_on_destroy gem here , but it is not quite finished and it seems rails 2.2. Is there any other new stone or some feature in the rails?
affected_on_destroy
I wrote gem affected_by_destroy , the source can be found here .
affected_by_destroy
Class.reflect_on_all_associations. keep_if{ |assoc| assoc.options[:dependent] == :destroy }.map(&:name)
It may not be exactly what you are looking for, but I think that reflect_on_all_associations should provide you with what you want.
reflect_on_all_associations
Source: https://habr.com/ru/post/1433323/More articles:Checking .Net assembly version - .netcan not get drag and drop use localstorage - javascriptMonospaced font for junit in eclipse? - javatornado warning [Errno 104] Connection reset by peer - pythonNode.js w / express error handling in callback - node.jsHow to find an integer array in an array of cells in Matlab? - matlabCreating a Visual Studio project with various platforms through MSBuild - visual-studioHow to convert .evtx eventlog to csv - c #how to set 3 divs side by side SO TA so that the middle div can stretch with changing shape - cssPositioning custom markers on a Google map - javascriptAll Articles