ironsand
ironsand

Reputation: 15161

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

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.

Upvotes: 3

Views: 1251

Answers (1)

joelparkerhenderson
joelparkerhenderson

Reputation: 35483

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'

Upvotes: 2

Related Questions