用于RailsUpgrade的未定义方法`cattr_accessor':: Upgraders :: RouteRedrawer:Class

时间:2011-12-06 02:23:53

标签: ruby-on-rails ruby-on-rails-3

我正在将Rails 2应用程序升级到Rails 3。 然后我安装了rails-upgrade gem:

$ gem install rails-upgrade --user-install
Fetching: rails-upgrade-0.0.2.gem (100%)
PostInstall.txt
Successfully installed rails-upgrade-0.0.2
1 gem installed
Installing ri documentation for rails-upgrade-0.0.2...
Installing RDoc documentation for rails-upgrade-0.0.2...

然后我跑了check,但它引发了这个错误:

$ rails-upgrade check
/home/neoriddle/.gem/ruby/1.8/gems/rails-upgrade-0.0.2/lib/rails-upgrade/upgraders/routes.rb:28: undefined method `cattr_accessor' for RailsUpgrade::Upgraders::RouteRedrawer:Class (NoMethodError)
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `gem_original_require'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `require'
    from /home/neoriddle/.gem/ruby/1.8/gems/rails-upgrade-0.0.2/lib/rails-upgrade.rb:12
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `gem_original_require'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:55:in `require'
    from /home/neoriddle/.gem/ruby/1.8/gems/rails-upgrade-0.0.2/bin/rails-upgrade:7
    from /home/neoriddle/.gem/ruby/1.8/bin/rails-upgrade:19:in `load'
    from /home/neoriddle/.gem/ruby/1.8/bin/rails-upgrade:19

有什么问题,如何解决?

我已经安装了Rails 3并且需要所有依赖项:

$ rails -v
Rails 3.0.9
$ ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-linux]
$ gem list active

*** LOCAL GEMS ***

active_scaffold_vho (3.0.20)
activemerchant (1.15.0, 1.14.0)
activemodel (3.0.9, 3.0.7, 3.0.5, 3.0.3)
activerecord (3.0.9, 3.0.7, 3.0.3, 2.3.11, 2.3.5, 2.2.3, 2.1.2, 2.1.1, 2.0.5, 1.15.3)
activeresource (3.0.9, 3.0.7, 3.0.3, 2.3.11, 2.3.5, 2.2.3, 2.1.2, 2.1.1)
activesupport (3.0.9, 3.0.7, 3.0.5, 3.0.3, 2.3.11, 2.3.5, 2.2.3, 2.1.2, 2.1.1, 2.0.5, 1.4.2)
$ gem list action

*** LOCAL GEMS ***

actionmailer (3.0.9, 3.0.7, 3.0.3, 2.3.11, 2.3.5, 2.2.3, 2.1.2, 2.1.1, 1.3.3)
actionpack (3.0.9, 3.0.7, 3.0.3, 2.3.11, 2.3.5, 2.2.3, 2.1.2, 2.1.1, 1.13.3)
actionwebservice (1.2.6, 1.2.3)

如果你需要更多信息,请问我。

1 个答案:

答案 0 :(得分:0)

我不认为此gem已更新为与Rails 3兼容。唯一的另一种选择是获取Rails 3 Upgrade Handbook的副本并使用它来完成升级过程。

我写了一篇关于将Rails 2应用程序升级到Rails 3的博客文章:http://ryanbigg.com/2010/11/the-rails-3-upgrade/