ActiveRecord: List columns in table from console

前端 未结 8 1378
遥遥无期
遥遥无期 2020-12-22 23:21

I know that you can ask ActiveRecord to list tables in console using:

ActiveRecord::Base.connection.tables

Is there a command that would li

8条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-22 23:42

    This will list the column_names from a table

    Model.column_names
    e.g. User.column_names
    

提交回复
热议问题