【发布时间】:2014-11-08 05:13:11
【问题描述】:
我发现这样的东西:Rails: How to list database tables/objects using the Rails console?
这条线很好:
ActiveRecord::Base.connection.tables
并返回所有表
但是
ActiveRecord::Base.connection.table_structure("users")
产生错误:
ActiveRecord::Base.connection.table_structure("projects")
我认为
table_structure
不是 Postgres 方法。
如何在 Rails 控制台中为 Postgres 数据库列出表中的所有数据?
【问题讨论】:
标签: sql ruby-on-rails ruby postgresql activerecord