2013-03-15 162 views
3

我使用rbenv,Bundler 1.0.21,rubygems 1.8.1,Ruby v1.8.7,rails 2.3.15和rails 3.0.18。我正在將我的rails應用程序從2.3.15遷移到rails 3.0.18。當我在這些版本之間切換時,我運行「捆綁安裝」指向正確的一組寶石。而這一直很好,直到我從軌3.0.18回2.3.15切換,跑了規範和獲取:未初始化的常量ActiveSupport :: Concern(NameError)

/Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/activesupport-2.3.15/lib/active_support/dependencies.rb:466:in 
`load_missing_constant': uninitialized constant ActiveSupport::Concern (NameError) 
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/activesupport-2.3.15/lib/active_support/dependencies.rb:106:in `const_missing' 
from /Users/me/Code/repos/microplace/vendor/plugins/verification/lib/action_controller/verification.rb:3 
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/actionpack-2.3.15/lib/action_controller/base.rb:1418 
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/actionpack-2.3.15/lib/action_controller/base.rb:1416:in `class_eval' 
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/actionpack-2.3.15/lib/action_controller/base.rb:1416 
from /Users/me/Code/repos/microplace/config/environments/development.rb:12:in `load_environment' 
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/initializer.rb:386:in `load_environment' 
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/activesupport-2.3.15/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings' 
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/initializer.rb:379:in `load_environment' 
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/initializer.rb:137:in `process' 
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/initializer.rb:113:in `send' 
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/initializer.rb:113:in `run' 
from /Users/me/Dropbox/Code/repos/microplace/config/environment.rb:15 
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/commands/runner.rb:39:in `require' 
from /Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/rails-2.3.15/lib/commands/runner.rb:39 
from script/runner:3:in `require' 
from script/runner:3 

想,也許有RubyGems的有一些不兼容的問題,我想降級到1.3版本.4,1.4.5和1.5.0,結果相同。

當我運行的寶石,其軌道,它給了:

/Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/railties-3.0.18/lib/rails.rb 

所以,我卸載railties。結果相同。

寶石其中的ActiveSupport的回報:

/Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems/activesupport-2.3.15/lib/activesupport.rb 

我也嘗試使用這個刪除所有的寶石在我.rbenv /版本/ 1.8.7-P357/lib中/紅寶石/寶石/ 1.8 /寶石/目錄腳本:https://gist.github.com/IanVaughan/2902499並使用軟件包安裝重新安裝,結果相同。

這裏是我的Gemfile

source :gemcutter 
gem "rails", "2.3.15" 
gem 'activesupport', '2.3.15' 
gem "mysql" 
gem "rake", "0.9.2" 
gem "rack", "1.1.3" 
gem "mongrel" 

# bundler requires these gems in all environments 
gem "nokogiri" 
gem "money", "5.0.0" 
gem "memcache-client" 
gem "oauth" 
gem "fastercsv" 
gem "pdf-writer" 
gem "json", "1.5.3" 
gem "rmagick", :require => 'RMagick' 
gem "twitter" 
gem "will_paginate", "2.3.15" 
gem "image_science" 
gem "RubyInline" 
gem "sentry" 
gem "netaddr" 
gem "hashie" 
gem "activemerchant", "~>1.24.0" 
gem "httparty" 
gem "httmultiparty" 
gem "ruby-hmac" 
gem "mogli" 
gem "SystemTimer" 
gem "net-sftp" 
gem "roxml" 
gem "rdoc" 
gem "omniauth-salesforce" 
gem "xml-simple" 
gem "rcov" 
gem "ZenTest", "4.8.3" 

group :development do 
    # bundler requires these gems in development 
    # gem "rails-footnotes" 
end 

group :test do 
    # bundler requires these gems while running tests 
    gem "rdoc" 
    gem "rcov" 
    gem "factory_girl", '2.6.4' 
    gem "mocha", '< 0.13.0', :require => false 
    gem "timecop" 
    gem "rspec", '~> 1.3.0' 
    gem "rspec-rails", '~> 1.3.4' 
    gem "cucumber-rails", '~> 0.3.2' 
    gem "database_cleaner", '~> 0.5.0' 
    gem "webrat", '~> 0.7.0' 
    gem "redgreen" 
    gem "launchy" 
    gem 'shoulda', :require => false 
end 

group :development, :test do 
    gem "ruby-debug" 
    #gem "ruby-debug-ide" 
end 

group :production, :salesforce_staging do 
    gem "mongrel_cluster" 
    gem "daemons" 
end 

Gemfile.lock的:

GEM 
    remote: http://rubygems.org/ 
    specs: 
    RubyInline (3.12.1) 
     ZenTest (~> 4.3) 
    SystemTimer (1.2.3) 
    ZenTest (4.8.3) 
    actionmailer (2.3.15) 
     actionpack (= 2.3.15) 
    actionpack (2.3.15) 
     activesupport (= 2.3.15) 
     rack (~> 1.1.3) 
    active_utils (1.0.5) 
     activesupport (>= 2.3.11) 
     i18n 
    activemerchant (1.24.0) 
     active_utils (>= 1.0.2) 
     activesupport (>= 2.3.11) 
     builder (>= 2.0.0) 
     i18n 
     json (>= 1.5.1) 
     money 
     nokogiri 
    activerecord (2.3.15) 
     activesupport (= 2.3.15) 
    activeresource (2.3.15) 
     activesupport (= 2.3.15) 
    activesupport (2.3.15) 
    addressable (2.3.3) 
    builder (3.2.0) 
    cgi_multipart_eof_fix (2.5.0) 
    color (1.4.1) 
    columnize (0.3.6) 
    cucumber (1.2.1) 
     builder (>= 2.1.2) 
     diff-lcs (>= 1.1.3) 
     gherkin (~> 2.11.0) 
     json (>= 1.4.6) 
    cucumber-rails (0.3.2) 
     cucumber (>= 0.8.0) 
    daemons (1.1.9) 
    database_cleaner (0.5.2) 
    diff-lcs (1.2.1) 
    factory_girl (2.6.4) 
     activesupport (>= 2.3.9) 
    faraday (0.8.6) 
     multipart-post (~> 1.1) 
    fastercsv (1.5.5) 
    fastthread (1.0.7) 
    gem_plugin (0.2.3) 
    gherkin (2.11.5) 
     json (>= 1.4.6) 
    hashie (1.2.0) 
    httmultiparty (0.3.8) 
     httparty (>= 0.7.3) 
     multipart-post 
    httparty (0.10.2) 
     multi_json (~> 1.0) 
     multi_xml (>= 0.5.2) 
    httpauth (0.2.0) 
    i18n (0.6.4) 
    image_science (1.2.4) 
     RubyInline (~> 3.9) 
    json (1.5.3) 
    launchy (2.2.0) 
     addressable (~> 2.3) 
    linecache (0.46) 
     rbx-require-relative (> 0.0.4) 
    memcache-client (1.8.5) 
    metaclass (0.0.1) 
    mocha (0.12.10) 
     metaclass (~> 0.0.1) 
    mogli (0.0.28) 
     httparty (>= 0.4.3) 
    money (5.0.0) 
     i18n (~> 0.4) 
     json 
    mongrel (1.1.5) 
     cgi_multipart_eof_fix (>= 2.4) 
     daemons (>= 1.0.3) 
     fastthread (>= 1.0.1) 
     gem_plugin (>= 0.2.3) 
    mongrel_cluster (1.0.5) 
     gem_plugin (>= 0.2.3) 
     mongrel (>= 1.0.2) 
    multi_json (1.6.1) 
    multi_xml (0.5.3) 
    multipart-post (1.2.0) 
    mysql (2.9.1) 
    net-sftp (2.1.1) 
     net-ssh (>= 2.6.5) 
    net-ssh (2.6.6) 
    netaddr (1.5.0) 
    nokogiri (1.5.6) 
    oauth (0.4.7) 
    oauth2 (0.6.1) 
     faraday (~> 0.7) 
     httpauth (~> 0.1) 
     multi_json (~> 1.3) 
    omniauth (1.1.3) 
     hashie (~> 1.2) 
     rack 
    omniauth-oauth2 (1.0.2) 
     oauth2 (~> 0.6.0) 
     omniauth (~> 1.0) 
    omniauth-salesforce (1.0.3) 
     omniauth (~> 1.0) 
     omniauth-oauth2 (~> 1.0) 
    pdf-writer (1.1.8) 
     color (>= 1.4.0) 
     transaction-simple (~> 1.3) 
    rack (1.1.3) 
    rack-test (0.6.2) 
     rack (>= 1.0) 
    rails (2.3.15) 
     actionmailer (= 2.3.15) 
     actionpack (= 2.3.15) 
     activerecord (= 2.3.15) 
     activeresource (= 2.3.15) 
     activesupport (= 2.3.15) 
     rake (>= 0.8.3) 
    rake (0.9.2) 
    rbx-require-relative (0.0.9) 
    rcov (1.0.0) 
    rdoc (4.0.0) 
     json (~> 1.4) 
    redgreen (1.2.2) 
    rmagick (2.13.2) 
    roxml (3.3.1) 
     activesupport (>= 2.3.0) 
     nokogiri (>= 1.3.3) 
    rspec (1.3.2) 
    rspec-rails (1.3.4) 
     rack (>= 1.0.0) 
     rspec (~> 1.3.1) 
    ruby-debug (0.10.4) 
     columnize (>= 0.1) 
     ruby-debug-base (~> 0.10.4.0) 
    ruby-debug-base (0.10.4) 
     linecache (>= 0.3) 
    ruby-hmac (0.4.0) 
    sentry (0.5.3) 
    shoulda (3.0.1) 
     shoulda-context (~> 1.0.0) 
     shoulda-matchers (~> 1.0.0) 
    shoulda-context (1.0.2) 
    shoulda-matchers (1.0.0) 
    simple_oauth (0.2.0) 
    timecop (0.6.0) 
    transaction-simple (1.4.0.2) 
    twitter (4.6.0) 
     faraday (~> 0.8, < 0.10) 
     multi_json (~> 1.0) 
     simple_oauth (~> 0.2) 
    webrat (0.7.3) 
     nokogiri (>= 1.2.0) 
     rack (>= 1.0) 
     rack-test (>= 0.5.3) 
    will_paginate (2.3.15) 
    xml-simple (1.1.2) 

PLATFORMS 
    ruby 

DEPENDENCIES 
    RubyInline 
    SystemTimer 
    ZenTest (= 4.8.3) 
    activemerchant (~> 1.24.0) 
    activesupport (= 2.3.15) 
    cucumber-rails (~> 0.3.2) 
    daemons 
    database_cleaner (~> 0.5.0) 
    factory_girl (= 2.6.4) 
    fastercsv 
    hashie 
    httmultiparty 
    httparty 
    image_science 
    json (= 1.5.3) 
    launchy 
    memcache-client 
    mocha (< 0.13.0) 
    mogli 
    money (= 5.0.0) 
    mongrel 
    mongrel_cluster 
    mysql 
    net-sftp 
    netaddr 
    nokogiri 
    oauth 
    omniauth-salesforce 
    pdf-writer 
    rack (= 1.1.3) 
    rails (= 2.3.15) 
    rake (= 0.9.2) 
    rcov 
    rdoc 
    redgreen 
    rmagick 
    roxml 
    rspec (~> 1.3.0) 
    rspec-rails (~> 1.3.4) 
    ruby-debug 
    ruby-hmac 
    sentry 
    shoulda 
    timecop 
    twitter 
    webrat (~> 0.7.0) 
    will_paginate (= 2.3.15) 
    xml-simple 

我難倒。在此先感謝,對於我能如何克服這一點的任何想法!

回答

0

事實證明,這個問題是由我已經安裝的Rails 3插件引起的,但沒有提交給git。所以當我切換回Rails 2.3.15分支時,插件依然存在。 (驗證插件)

我發現了這一點,只需在我的項目根目錄下爲「ActiveSupport :: Concern」遞歸grep。我在

/Users/me/.rbenv/versions/1.8.7-p357/lib/ruby/gems/1.8/gems 

目錄也這樣做,並發現黃瓜軌寶石實例化的ActiveSupport ::關注。從那裏,我鬆開了Gemfile中的版本並重新運行軟件包安裝。這降低了黃瓜欄的版本。我不知道是否cucumber-rails也導致了錯誤,但我懷疑是這樣,因爲它稱爲ActiveSupport :: Concern。

希望這可以幫助別人在未來!

相關問題