0

我试图生成如下迁移:

rails generate migration RemovefromGenotypes box:integer well:string

但后来我得到这个错误:

/usr/share/rails-ruby1.8/railties/lib/rails_generator/options.rb:32:in `default_options': undefined method `write_inheritable_attribute' for Rails::Generator::Base:Class (NoMethodError)
    from /usr/share/rails-ruby1.8/railties/lib/rails_generator/base.rb:90:in `<class:Base>'
    from /usr/share/rails-ruby1.8/railties/lib/rails_generator/base.rb:85:in `<module:Generator>'
    from /usr/share/rails-ruby1.8/railties/lib/rails_generator/base.rb:48:in `<module:Rails>'
    from /usr/share/rails-ruby1.8/railties/lib/rails_generator/base.rb:6:in `<top (required)>'
    from /home/caseyr/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/caseyr/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/share/rails-ruby1.8/railties/lib/rails_generator.rb:34:in `<top (required)>'
    from /home/caseyr/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /home/caseyr/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/share/rails-ruby1.8/railties/bin/rails:14:in `<main>'

我不知道从哪里开始调试这个,但如果有人能指出我正确的方向,我会很感激......

谢谢!--瑞克

4

2 回答 2

3

在rails 3.2.6之后安装rails 2.3.14时发生在我身上

似乎 rails 2.3 覆盖了一些 rails 3 文件。通过删除 2.3 并重新安装 3.2 修复

于 2012-07-02T09:54:06.300 回答
2

我有同样的问题。使用以下命令,问题就消失了

 gem install rails

这将安装更新的导轨并再次找到所有工作。

于 2012-06-18T08:03:52.720 回答