Created
February 17, 2020 17:23
-
-
Save ekumachidi/95ef9192b99a97f8be32a94eca7efa84 to your computer and use it in GitHub Desktop.
List all classes in your rails app
This file contains 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! | |
ActiveRecord::Base.descendants # It returns all models and its attributes. | |
ActiveRecord::Base.descendants.collect(&:name) # It returns only the model names | |
# If you're using > rails 5.0 you can use the line below | |
ApplicationRecord.descendants.collect(&:name) # It returns only the model names |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment