0

当我annotate在命令行运行时,我收到以下错误:

$ annotate
/.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/application.rb:215:in `initialize_tasks': undefined method `task' for #<MyApp::Application:0x00000102e03b90> (NoMethodError)
    from /.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/application.rb:139:in `load_tasks'
    from /.rvm/gems/ruby-1.9.2-p0/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
    from Rakefile:8:in `<top (required)>'
    from /.rvm/gems/ruby-1.9.2-p0/gems/annotate-2.4.0/lib/annotate.rb:17:in `load'
    from /.rvm/gems/ruby-1.9.2-p0/gems/annotate-2.4.0/lib/annotate.rb:17:in `load_tasks'
    from /.rvm/gems/ruby-1.9.2-p0/gems/annotate-2.4.0/bin/annotate:66:in `<top (required)>'
    from /.rvm/gems/ruby-1.9.2-p0/bin/annotate:19:in `load'
    from /.rvm/gems/ruby-1.9.2-p0/bin/annotate:19:in `<main>'

这就是我的 Gemfile 的样子:

source 'http://rubygems.org'

gem 'rails'

gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'will_paginate', '3.0.pre2'

gem 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git'
gem 'mime-types', :require => 'mime/types'

gem 'rails3-generators'

gem 'devise',  '~> 1.1.3'
gem 'devise_invitable', '~> 0.3.4'

gem 'declarative_authorization', :git => 'git://github.com/stffn/declarative_authorization.git'

gem 'aasm'
gem 'braintree'

#For voting
gem 'thumbs_up'

# For In-Place-Editing
gem 'best_in_place'

#For slugs for the plans
gem "friendly_id", "~> 3.2"

gem 'aws-s3'

group :development do
    # Server
    gem 'thin'
    gem 'annotate-models', '1.0.4'
    #gem 'rails-erd'
    gem 'annotate'
    gem 'faker', '0.3.1'
    gem 'ruby_parser'
end

顺便说一句,这一切都在我的本地主机上。

4

2 回答 2

0

我已经使用gem 'annotate', ">=2.5.0".

我正在使用 ruby​​ 1.9.2p320 和 Rails 3.2.13。

于 2013-08-29T02:23:19.900 回答
0

Marcamillion,它可能坏了,因为在某个阶段你安装了 rake 0.9.0,这对很多人来说破坏了很多东西,而没有弃用方法或警告人们。当你运行 bundle update 时,它​​会安装 rake 0.9.2 来解决这个问题。希望这对其他人有帮助。

于 2011-06-13T05:56:46.517 回答