2014-02-19 51 views
0

我是ruby,rails和mysql的新手。未初始化的常量ActiveSupport :: CoreExtensions :: Date :: Calculations

我的操作系統是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>' 

這是很奇怪的,我不知道如何處理它。有任何想法嗎?

回答

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 

如果你沒有自己固定它相信您應該刪除這個寶石。

+0

感謝您的回覆。我試圖從我的gemfile中刪除date_time_precision,這個錯誤消失了,但另一個問題出來了。然後我嘗試了我的舊版Ubuntu 12.04,它成功了。我試圖找出爲什麼它是這樣的。再次感謝! – milodky

相關問題