Monday, July 5, 2010

irb with hirb


+----+---------------+-------------+-------------------------+-------------------------+
| id | name          | description | created_at              | updated_at              |
+----+---------------+-------------+-------------------------+-------------------------+
| 1  | Sports        | lorem ipsum | 2010-07-01 09:05:26 UTC | 2010-07-01 09:05:26 UTC |
| 2  | Fun           | lorem ipsum | 2010-07-01 09:05:26 UTC | 2010-07-01 09:05:26 UTC |
| 3  | Politics      | lorem ipsum | 2010-07-01 09:05:26 UTC | 2010-07-01 09:05:26 UTC |
| 4  | Lifestyle     | lorem ipsum | 2010-07-01 09:05:26 UTC | 2010-07-01 09:05:26 UTC |
| 5  | Entertainment | lorem ipsum | 2010-07-01 09:05:26 UTC | 2010-07-01 09:05:26 UTC |
+----+---------------+-------------+-------------------------+-------------------------+


How to print structure table to screen of terminal, it's possible with hirb gem
sample intruction here:

> sudo gem install hirb

require your own the hirb gem.


> nano ~/.irbrc


include this script.

require 'rubygems'
require 'hirb'
Hirb.enable

Now, you can enjoy to test

> script/console
> Model.all

hope helpful

No comments:

Post a Comment