Rails: How to list database tables/objects using the Rails console?

后端 未结 6 1765
忘了有多久
忘了有多久 2020-12-02 04:30

I was wondering if you could list/examine what databases/objects are available to you in the Rails console. I know you can see them using other tools, I am just curious. Tha

6条回答
  •  眼角桃花
    2020-12-02 04:54

    Run this:

    Rails.application.eager_load! 
    

    Then

    ActiveRecord::Base.descendants
    

    To return a list of models/tables

提交回复
热议问题