NoMethodError:升级到 rake 11 后未定义方法“last_comment" [英] NoMethodError: undefined method `last_comment' after upgrading to rake 11

查看:33
本文介绍了NoMethodError:升级到 rake 11 后未定义方法“last_comment"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行任何 rake 任务时,我得到:

<块引用>

NoMethodError: undefined method `last_comment' for

这是在bundle update之后引入了新版本的rake,版本11.0.1.

$ grep rake Gemfile.lock耙耙子 (>= 0.8.7)耙子 (11.0.1)耙$ 捆绑更新$ bundle exec rake db:drop # 任何耙任务

<块引用>

NoMethodError: #< 的未定义方法 `last_comment'Rake::Application:0x007ff0cf37be38>

版本

  • Rails 3.2.11
  • Rake 11.0.1

解决方案

Rake 11.0.1 删除 Rails 2.3 rspec-core (<3.4.4) 使用的 last_comment 方法.因此,直到/如果发布补丁,我们需要将 rake 固定到 Gemfile 中的旧版本:

gem 'rake', '<11.0'

然后:

$ 包更新$ grep rake Gemfile.lock耙耙子 (>= 0.8.7)耙子 (10.5.0)耙耙子 (< 11.0)

我们现在使用 rake 10.5.0,它仍然具有 last_comment 方法,我们的 rake 任务将再次工作.

更新:这个问题现在已经在 rspec 中修复了,所以唯一需要做的就是更新 rspec.

When running any rake task I get:

NoMethodError: undefined method `last_comment' for

This was after bundle update which pulled in the new version of rake, version 11.0.1.

$ grep rake Gemfile.lock
       rake
       rake (>= 0.8.7)
     rake (11.0.1)
       rake
$ bundle update
$ bundle exec rake db:drop # any rake task

NoMethodError: undefined method `last_comment' for #< Rake::Application:0x007ff0cf37be38>

Versions

  • Rails 3.2.11
  • Rake 11.0.1

解决方案

Rake 11.0.1 removes the last_comment method which Rails 2.3 rspec-core (< 3.4.4) uses. Therefore until/if a patch is released we need to pin rake to an older version in Gemfile:

gem 'rake', '< 11.0'

then:

$ bundle update
$ grep rake Gemfile.lock 
      rake
      rake (>= 0.8.7)
    rake (10.5.0)
      rake
  rake (< 11.0)

We are now using rake 10.5.0 which still has the last_comment method and our rake tasks will work again.

UPDATE: This has now been fixed in rspec, so the only thing necessary should be updating rspec.

这篇关于NoMethodError:升级到 rake 11 后未定义方法“last_comment"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆