Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't load `active_support/core_ext` in ruby 2.1.5

Tags:

ruby

When I require 'active_support/core_ext', then get a 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 activesupport gem.

# gem list --local | grep activesupport
activesupport (4.2.0)

Should I install some other gems to use active_support/core_ext?

I'm using ruby 2.1.5p273 in Ubuntu14.04.

like image 938
ironsand Avatar asked Dec 06 '25 08:12

ironsand


1 Answers

Presuming you're 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' 

Newer Ruby versions may be able skip rubygems, setup, and core_ext, and just use this:

require 'active_support'
like image 124
joelparkerhenderson Avatar answered Dec 07 '25 23:12

joelparkerhenderson



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!