未初始化的常量ActiveSupport :: CoreExtensions :: Date :: Calculations

时间:2014-02-19 23:49:57

标签: ruby gem

我是ruby,rails和mysql的新手。

我的操作系统是Ubuntu 13.04,ruby的版本是1.9.3p194(2012-04-20修订版35410)[x86_64-linux],rails的版本是3.2.13。

当我执行此命令时:rake db:migrate --trace,我遇到了这样的错误:

rake aborted!
uninitialized constant ActiveSupport::CoreExtensions::Date::Calculations
/usr/lib/ruby/vendor_ruby/active_support/core_ext/date.rb:8:in `<class:Date>'
/usr/lib/ruby/vendor_ruby/active_support/core_ext/date.rb:6:in `<top (required)>'
/var/lib/gems/1.9.1/gems/date_time_precision-0.5.3/lib/date_time_precision/lib.rb:4:in `block in <top (required)>'
/var/lib/gems/1.9.1/gems/date_time_precision-0.5.3/lib/date_time_precision/lib.rb:2:in `each'
/var/lib/gems/1.9.1/gems/date_time_precision-0.5.3/lib/date_time_precision/lib.rb:2:in `<top (required)>'
/var/lib/gems/1.9.1/gems/date_time_precision-0.5.3/lib/date_time_precision/patch.rb:1:in `<top (required)>'
/var/lib/gems/1.9.1/gems/date_time_precision-0.5.3/lib/date_time_precision.rb:1:in `<top (required)>'
/var/lib/gems/1.9.1/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `require'
/var/lib/gems/1.9.1/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/var/lib/gems/1.9.1/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `each'
/var/lib/gems/1.9.1/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `block in require'
/var/lib/gems/1.9.1/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `each'
/var/lib/gems/1.9.1/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `require'
/var/lib/gems/1.9.1/gems/bundler-1.5.2/lib/bundler.rb:131:in `require'
/home/xye/Documents/Work/config/application.rb:14:in `<top (required)>'
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/xye/Documents/Work/Rakefile:5:in `<top (required)>'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/rake_module.rb:25:in `load'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/rake_module.rb:25:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:583:in `raw_load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:89:in `block in load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:88:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:72:in `block in run'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:70:in `run'
/var/lib/gems/1.9.1/gems/rake-10.0.3/bin/rake:33:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'

这很奇怪,我不知道如何处理它。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

名为date_time_precision的宝石与积极支持相冲突。

来自date_time_precision文档:

    Gem Compatibility

Sometimes other gems will use the Date/Time class in ways that don't preserve precision. If you want to use the DateTimePrecision gem with these gems, any compatibility issues will most likely need to be patched within DateTimePrecision itself. This is because DateTimePrecision makes some modifications to how the core Date/Time classes work. (For example, by allowing nil values to be passed to constructors.)

This gem should work with Rails/ActiveSupport 2, 3, and 4 (but perhaps missing some edge cases).

So far, the following gems are on the compatibility watch list:

    [.] ActiveSupport
    [x] Virtus
    [x] Coercible
    [ ] Chronic
    [ ] Timeliness
    [ ] Timecop
    [ ] delocalize

如果你没有信心自己修理它,你应该删除这个宝石。