문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top