Last active
August 29, 2015 14:02
-
-
Save JeffWaltzer/ca872115f41d763b13ae to your computer and use it in GitHub Desktop.
LIst all ActiveRecord models with relations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Rails.application.eager_load! | |
| puts ActiveRecord::Base.descendants.map {|m| [ m.name, m.reflections.values.map{|r| "#{r.macro} #{r.name}"} ]}.select{|k,v| v.size>0}.to_h.to_yaml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment