Skip to content

Rodrigo Urubatan – About Code

Helping ruby developers to use the best tools for each job so they can solve hard problems, with less bugs and have more free time.

Menu
  • Home
  • My last presentations
  • About
  • Privacy Policy
Menu

Do you wanna see tabular data in your rails console? check here to learn how!

Posted on 2018-07-31 by Rodrigo Urubatan

Have you ever thought about how Rails console was not built for you to read the results of a query that returns more than one object?

So, you are not the only one, and that is why there is a gem called ‘hirb’ that will blow your mind, it will make pretty tables of the query results from your object queries in rails console.

And I’m talking about changing this:

into this:

with just one line of code!

But the magic is not mine, it is implemented by the “hirb” gem, and to use it in your rails app, as always, just add the line:

gem 'hirb'

to your Gemfile, after that, every time you want to see tabular data in your rails console, just execute this line before the query:

Hirb.enable

And if you want to go back to the default, just disable it:

Hirb.disable

So, as always, the idea of this blog is to help you use the best tool for each job, and when you want to see tabular data in your console, for a quick report or just to analyse some data, ‘hirb’ is the best tool for the job.

Is there anything else that you think your rails console could do and you do not know how? leave a comment and I’ll try to help

Related

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent posts

  • Why Embrace Nesting in Ruby Modules?
  • An easy way to have a local “Github Copilot” for free
  • SPA without touching Javascript – The magic of Ruby on rails and Hotwire
  • I see Dead Jobs everywhere (sidekiq DeadSet)
  • Quick tips that help: rails notes

Arquives

  • May 2024
  • April 2024
  • February 2023
  • January 2023
  • December 2022
  • June 2021
  • March 2020
  • January 2020
  • July 2019
  • June 2019
  • May 2019
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018
  • February 2018
  • January 2018
  • November 2017
  • August 2015
  • August 2014
  • July 2014
  • August 2007

Categories

  • AI
  • articles
  • cfp
  • firebase
  • gems
  • git
  • opinion
  • presentations
  • projects
  • rails6
  • ruby
  • Sem categoria
  • server-api
  • tutorials
  • Uncategorized
© 2025 Rodrigo Urubatan – About Code | Powered by Minimalist Blog WordPress Theme