Skip to content

Instantly share code, notes, and snippets.

@brainopia
Created March 21, 2012 20:36
Show Gist options
  • Save brainopia/2152631 to your computer and use it in GitHub Desktop.
Save brainopia/2152631 to your computer and use it in GitHub Desktop.
ActiveRecord::Base.subclasses.
map {|model| model.reflections.values.select {|association| [:has_many, :has_one].include? association.macro }}.flatten.
each {|association| association.options[:dependent] = :destroy }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment