rails控制台输出如下所示:

User.all
=> [#<User id: 1, name: "Michael Hartl", email: "mhartl@example.com",
created_at: "2011-12-05 00:57:46", updated_at: "2011-12-05 00:57:46">,
#<User id: 2, name: "A Nother", email: "another@example.org", created_at:
"2011-12-05 01:05:24", updated_at: "2011-12-05 01:05:24">]

我想知道是否有命令可以让它更容易阅读?例如,MongoDB控制台中有一个.pretty命令,该命令将输出的格式设置得更加直观.但不确定Rails中是否有类似的东西.

推荐答案

你也可以用这个不可思议的Ruby :

Awesome Print

Ruby-on-rails相关问答推荐

如何测试自定义路由?

本地主机的上衣配置

关系 fields_for 上不允许的参数

Rails 5.1.7:Sprockets::Rails::Helper::AssetNotFound

Grape api (rails) - 未初始化常量 Endpoints::TodoAPI (NameError)

如何配置我的 Rails 应用程序(使用 Puma)以通过 HTTPS 提供服务?

序列化来自关联的不可变数据是个好主意吗?

Rails 'includes' 和 'where' 与 belongs_to 和 has_many 关联

将日期时间转换为月、日和年?

attr_accessible(*attributes) 和 attr_protected(*attributes) 有什么区别?

Rails 3 中图像路径的完整 url

FactoryGirl 和 Rspec 测试中 attributes_for 的含义

Gem 更新:在从 ASCII-8BIT 到 UTF-8 到 US-ASCII 的转换中,无法将 "\xE7" 转换为 UTF-8

Rails Mailer Net::OpenTimeout: execution expired 仅在生产服务器上出现异常

从控制器中删除 Cookie

rails回形针和乘客`'识别'命令无法识别`

如何在 ROR (Ruby) 中显示 PDF?

Rails 生成 has_many 关联

Rails.cache 在测试之间被清除了吗?

如何创建一个 ruby​​ Hello 世界?