Hirb does not work

I tried several different guides for Hirb, but rails cstubbornly refuses to load automatically with .irbrc.

Here is what I did.

# 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 productionor rails c test, Hirb starts working right away. But by running rails cand first you need Hirb::View.enable. I find this behavior very strange - could you shed some light? Thank.

+3
source share
1 answer

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

export RAILS_ENV='development'

, , , Gemfile ( hirb Gemfile, ?). .irbrc ? , (, - ~/.irbrc)?

+2

Source: https://habr.com/ru/post/1783005/


All Articles