Question

I want to display few active records in rails console, I have Hirb enabled. The table is narrow enough to be displayed (so Hirb uses standard, horizontal table) but columns are so narrow that content is completely unreadable. Do you have any idea what I could do about it?

Displaying only few columns would be great (I have records in a pure Array, not AR collection, so I cannot just pass :select to finder method). Forcing Hirb to display records in vertical table would be perfect as well.

Thanks in advance.

Was it helpful?

Solution

If you look at the 'Views: Anytime, Anywhere' section of hirb's readme, you'll see that hirb provides you with a table command that let's you select columns/fields:

>> extend Hirb::Console
=> main
>> table My_AR_Array, :fields=>[:field1, :another_field, :and_another_one]
# ... Displays table with only these three columns

If you'd like to enable a vertical view, read the docs. In particular, learn about a table's options (:vertical is what you want) and learn about hirb's config file format.

In the future, please ask these questions on github.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top