Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hirb doesn't work

I have tried a few different tutorials for Hirb but rails c is stubbornly refusing to load automatically using .irbrc.

Here's what I've been doing.

# From app directory
mate .irbrc

# Added to .irbrc
require 'rubygems'
require 'hirb'
extend Hirb::console
Hirb::View.enable

rails c development / rails c production / rails c test
Works as expected

rails c
User.last # Doesn't work
Hirb::View.enable
  true
User.last # Does work

The odd thing is this: when I load rails c development, rails c production or rails c test, Hirb starts working straight away. But, running rails c and it needs Hirb::View.enable first. I find this behavior very strange - could you help shed some light? Thank you.

like image 567
sscirrus Avatar asked Dec 05 '25 19:12

sscirrus


1 Answers

The first argument sets ENV['RAILS_ENV']. From what you've said, you could get around this quirk by adding this to your ~/.bashrc:

export RAILS_ENV='development'

However if you want to solve the root of your problem, you should mention what your Gemfile is (you do have hirb in your Gemfile, right?). Also is your .irbrc local to your application? If so, how is it automatically loaded (probably by something in your ~/.irbrc)?

like image 169
cldwalker Avatar answered Dec 08 '25 11:12

cldwalker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!