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

后端 未结 6 1780
忘了有多久
忘了有多久 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:38

    I hope my late answer can be of some help.
    This will go to rails database console.

    rails db
    

    pretty print your query output

    .headers on
    .mode columns
    (turn headers on and show database data in column mode )
    

    Show the tables

    .table
    

    '.help' to see help.
    Or use SQL statements like 'Select * from cars'

提交回复
热议问题