2

I would like to get nice printing by hirb in rake task. But I can't figure out how to setup hirb to print the ActiveRecord results.

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

I've got error "Table must be an array of hashes or array of arrays"

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
megas
  • 21,401
  • 12
  • 79
  • 130

1 Answers1

4
puts Hirb::Helpers::AutoTable.render(active_record_object)
megas
  • 21,401
  • 12
  • 79
  • 130