我想通过hirb
rake 任务获得漂亮的打印效果。但我不知道如何设置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
我有错误“表必须是散列数组或数组数组”