Configurando o HIRB no .irbrc, terminal
Quem acompanha o Railscasts vê frequentemente a saída do script/console
formatada em tabelas, esta formatação é feita usando o HIRB.
Para instalar use:
# gem install hirb
Successfully installed hirb-0.2.7
1 gem installed
Installing ri documentation for hirb-0.2.7...
Installing RDoc documentation for hirb-0.2.7...
Após isso configure no ~/.irbrc
:
require 'rubygems'
require 'hirb'
Hirb.enable :pager => false
Hirb.enable :formatter => false
Pronto basta abrir o script/console
:
$ ./script/console
Loading development environment (Rails 2.3.3)
Already enabled.
>> Department.all
+----+--------------+---------+---------+
| id | name | user_id | post_id |
+----+--------------+---------+---------+
| 1 | INFORMÁTICA | 2 | 1 |
| 3 | AUMOXARIFADO | 24 | 1 |
| 4 | SOROLOGIA | 22 | 1 |
+----+--------------+---------+---------+
3 rows in set