Created
March 10, 2023 14:01
-
-
Save rafaelqueiroz88/357e68736691255487e4473c464362e6 to your computer and use it in GitHub Desktop.
Listing all models in a Rails project
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! | |
ActiveRecord::Base.descendants # all models and its attributes | |
ApplicationRecord.descendants.collect(&:name) # filtering model names |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment