2

我想通过hirbrake 任务获得漂亮的打印效果。但我不知道如何设置hirb打印ActiveRecord结果。

task :t2 => :environment do
  require 'hirb'
  Hirb.enable
  result = Task.select('project_id, COUNT(*) AS counter').group('project_id').order('counter DESC')
  puts Hirb::Helpers::Table.render(result)
  Hirb.disable
end

我有错误“表必须是散列数组或数组数组”

4

1 回答 1

4
puts Hirb::Helpers::AutoTable.render(active_record_object)
于 2012-08-11T13:38:31.187 回答