作者热门文章
- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
当我需要 'active_support/core_ext'
时,出现错误:
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>'
当然我安装了activesupport
gem。
# gem list --local | grep activesupport
activesupport (4.2.0)
我应该安装一些其他的 gem 来使用 active_support/core_ext
吗?
我在 Ubuntu14.04 中使用 ruby 2.1.5p273
。
最佳答案
假设您正在使用 bundler ,请尝试使用此诊断代码以查看有效方法:
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'
较新的 Ruby 版本可能会跳过 rubygems
、setup
和 core_ext
,而只需使用它:
require 'active_support'
关于ruby - 无法在 ruby 2.1.5 中加载 `active_support/core_ext`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27674040/
我是一名优秀的程序员,十分优秀!