开发者

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

开发者 https://www.devze.com 2023-01-11 06:20 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消