Unable to load `active_support / core_ext` in ruby 2.1.5
When I require 'active_support/core_ext'
then get the error:
NameError: uninitialized constant ActiveSupport::Autoload from /opt/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0/lib/active_support/number_helper.rb:3:in `<module:NumberHelper>'
Of course I installed the activesupport
gem.
# gem list --local | grep activesupport
activesupport (4.2.0)
Should I install some other stones to use active_support/core_ext
?
I am using ruby 2.1.5p273
in Ubuntu14.04.
+3
source to share
1 answer
Assuming you are using bundler, try this diagnostic code to see what works:
require 'rubygems' # You may be able to omit this line
require 'bundler/setup' # You may be able to omit this line
require 'active_support'
require 'active_support/core_ext'
New versions of Ruby can pass rubygems
, setup
and core_ext
simply use it:
require 'active_support'
+2
source to share