我想为运行Rails 2.3.14和Ruby 1.8.7的站点生成新的迁移。我写了命令
ruby script/generate migration AssetTable
期望脚本在db / migrate目录中生成文件20130522161112_asset_table.rb。但是我没有看到这个文件。运行上述命令后得到的输出是:
/var/lib/gems/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:81:in `add_load_paths': undefined method `requirement' for #<Rails::GemDependency:0x7ffd183eba58> (NoMethodError)
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:301:in `add_gem_load_paths'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:301:in `each'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:301:in `add_gem_load_paths'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:132:in `process'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:in `send'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:in `run'
from /var/www/pbcore/releases/20120416101734/config/environment.rb:17
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/commands/generate.rb:1
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require
有谁知道我在这里做错了什么?
答案 0 :(得分:2)
根据您的rubygems版本,您可以尝试运行:
$ gem install rubygems-update -v='1.4.2'
$ gem uninstall rubygems-update -v='1.5.0'
$ update_rubygems
见到这里:Gem dependency error in rails 2.3.4:
这种情况正在发生,因为您安装的RubyGems太新了 你的Rails版本。降级(并重新运行update_rubygems) 或者将Rails升级到2.3.11。