I am using rails 4.1 and ruby 2.1.1
Everything works, but when I run rails console I get this error
> rails console
Loading development environment (Rails 4.1.0)
load error: /home/andreas/.rvm/rubies/ruby-2.1.1/.irbrc
NoMethodError: undefined method `split' for nil:NilClass
/home/andreas/.rvm/scripts/irbrc.rb:41:in `<top (required)>'
After the error the console opens and can be used.
Here's the 41th line and surroundings in the .irbrc file.
39 # Calculate the ruby string.
40 rvm_ruby_string = ENV["rvm_ruby_string"] ||
41 (ENV['GEM_HOME'] && ENV['GEM_HOME'].split(/\//).last.split(/@/).first) ||
42 ("#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}" rescue nil) ||
43 (RUBY_DESCRIPTION.split(" ")[1].sub('p', '-p') rescue nil ) ||
44 (`ruby -v` || '').split(" ")[1].sub('p', '-p')
I get these results when testing in the console
irb(main):008:0> ENV['GEM_HOME']
=> ""
irb(main):009:0> ENV['GEM_HOME'].split(/\//).last
=> nil
If I run irb outside the rails application, I get
2.1.1 :001 > ENV['GEM_HOME']
=> "/home/andreas/.rvm/gems/ruby-2.1.1"
2.1.1 :002 > ENV['GEM_HOME'].split(/\//).last
=> "ruby-2.1.1"
Do you know why the environment variable is blank in the rails application?