【问题标题】:Rails 3 annotate doesn't workRails 3注释不起作用
【发布时间】:2011-06-13 01:15:53
【问题描述】:

当我在命令行运行 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

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

【问题讨论】:

  • Ran bundle update 似乎已经解决了这个问题。以前没有,所以不知道为什么。让 Rails 来愚弄我吧:|

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


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    我已经使用gem 'annotate', "&gt;=2.5.0" 解决了这个问题。

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

    【讨论】:

      猜你喜欢
      • 2011-05-30
      • 2014-08-14
      • 1970-01-01
      • 2011-11-20
      • 2013-09-20
      • 2020-10-09
      • 2012-09-19
      • 2015-09-14
      • 2017-08-20
      相关资源
      最近更新 更多