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.
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)?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With