mdrozdziel
mdrozdziel

Reputation: 5558

Table format in Hirb for .where Rails 3 queries

I am using http://tagaholic.me/hirb/ to format AR queries in console with pretty, MySQL like table views.

The problem is, that by default Rails 3 .where queries, reaturned as ActiveRecord::Relation arent displayed in a table format. With imported table method everything is formatted properly. How to set default display to table in Hirb for a given object type?

Upvotes: 0

Views: 937

Answers (2)

msroot
msroot

Reputation: 837

Or you can use richrc RichRC (Rich Rails Console) is a customization tool for Rails 3 console.

sudo gem install richrc hirb wirble

make a new alias in ~/.bash_profile

alias railsc="richrc"

source ~/.bash_profile

insted of rails c use:

railsc

website: richrc

Upvotes: 0

Zubin
Zubin

Reputation: 9742

It works for me with hirb version 0.3.5 and Rails 3.0.1.

Check your ~/.irbrc file doesn't use ENV['RAILS_ENV'] to determine whether to load Hirb, because Rails 3 no longer sets that. Use this instead:

# ~/.irbrc
Hirb.enable if defined?(Rails)

If using RVM, add it to your Gemfile to ensure hirb is correctly loaded:

# Gemfile
gem 'hirb', :require => nil

Upvotes: 1

Related Questions