0

I need to create a graphical view of the tables in rails console. by example Country.all that shows me a table in graphical form![enter image description here][1]

https://i.stack.imgur.com/fyw0o.png

I don't know that gem to use. I'm a newbie

user3623442
  • 131
  • 1
  • 1
  • 9
  • check this link http://stackoverflow.com/questions/1224525/how-to-get-nice-formatting-in-the-rails-console – anusha Oct 15 '14 at 04:55

1 Answers1

0

You can use 'hirb' gem to get graphical view in rails console

gem install hirb

open rails console

rails c

then try this

2.1.2 :001 > require 'hirb'
 => false 
2.1.2 :002 > Hirb.enable
 => true 
2.1.2 :003 > Advertiser.all
  Advertiser Load (3.1ms)  SELECT "advertisers".* FROM "advertisers"  WHERE "advertisers"."deleted_at" IS NULL
+----+----------+---------+---------+---------+---------+----------+----------+---------+---------+-------+----------+----------+---------+----------+
| id | hash_tag | adve... | comp... | user_id | crea... | updat... | delet... | address | city    | state | posta... | phone    | comp... | total... |
+----+----------+---------+---------+---------+---------+----------+----------+---------+---------+-------+----------+----------+---------+----------+
| 2  |          | Comm... |         | 6       | 2014... | 2014-... |          | kaki... |         |       |          | 88975... | Anusha  | 500.0    |
| 1  |          |         |         | 4       | 2014... | 2014-... |          | kaki... | kaki... |       |          |          | test    | 1000.0   |
+----+----------+---------+---------+---------+---------+----------+----------+---------+---------+-------+----------+----------+---------+----------+
2 rows in set
2.1.2 :004 > 
anusha
  • 2,087
  • 19
  • 31