安装Rails 2.3.2和version_requirements时出现问题

时间:2011-07-20 12:42:59

标签: ruby-on-rails gem

以前我没有使用Rails 2.3.2安装这样的问题。有人有什么建议我该如何解决?

`$ ruby​​ script / server

=>启动WEBrick => Rails 2.3.2应用程序从http://0.0.0.0:3000

开始

/home/thesis/.rvm/gems/ruby-1.8.7-p334@my_app/gems/rails-2.3.2/lib/rails/gem_dependency.rb:99:in'requirement':未定义的局部变量或方法'version_requirements'用于#(NameError)

from /home/thesis/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems.rb:254:in 'activate'
from /home/thesis/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems.rb:1204:in 'gem'
from /home/thesis/.rvm/gems/ruby-1.8.7-p334@my_app/gems/rails-2.3.2/lib/rails/gem_dependency.rb:57:in 'add_load_paths'
from /home/thesis/.rvm/gems/ruby-1.8.7-p334@my_app/gems/rails-2.3.2/lib/initializer.rb:299:in 'add_gem_load_paths'
from /home/thesis/.rvm/gems/ruby-1.8.7-p334@my_app/gems/rails-2.3.2/lib/initializer.rb:299:in 'each'
from /home/thesis/.rvm/gems/ruby-1.8.7-p334@my_app/gems/rails-2.3.2/lib/initializer.rb:299:in 'add_gem_load_paths'
from /home/thesis/.rvm/gems/ruby-1.8.7-p334@my_app/gems/rails-2.3.2/lib/initializer.rb:132:in 'process'
from /home/thesis/.rvm/gems/ruby-1.8.7-p334@my_app/gems/rails-2.3.2/lib/initializer.rb:113:in 'send'
from /home/thesis/.rvm/gems/ruby-1.8.7-p334@my_app/gems/rails-2.3.2/lib/initializer.rb:113:in 'run'
from /home/thesis/development/tt/my_app/config/environment.rb:15
from /home/thesis/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in 'gem_original_require'
from /home/thesis/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in 'require'
from /home/thesis/.rvm/gems/ruby-1.8.7-p334@my_app/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in 'require'
from /home/thesis/.rvm/gems/ruby-1.8.7-p334@my_app/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in 'new_constants_in'
from /home/thesis/.rvm/gems/ruby-1.8.7-p334@my_app/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in 'require'
from /home/thesis/.rvm/gems/ruby-1.8.7-p334@my_app/gems/rails-2.3.2/lib/commands/server.rb:84
from /home/thesis/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in 'gem_original_require'
from /home/thesis/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in 'require'
from script/server:3`

1 个答案:

答案 0 :(得分:3)

将以下代码放在您的environment.rb中。它可能会解决你的问题

if Gem::VERSION >= "1.3.6"
    module Rails
      class GemDependency
        def requirement
          r = super
          (r == Gem::Requirement.default) ? nil : r
        end
      end
    end
  end