How to force a vertical table or limit columns in Hirb?
Asked Answered
C

1

7

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.

Credible answered 11/8, 2010 at 11:57 Comment(0)
S
8

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.

Surbase answered 12/8, 2010 at 7:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.