NoMethodError: undefined method `last_comment' after upgrading to rake 11

后端 未结 5 900
误落风尘
误落风尘 2020-12-13 03:14

When running any rake task I get:

NoMethodError: undefined method `last_comment\' for

This was after

5条回答
  •  粉色の甜心
    2020-12-13 03:41

    in Rails quick fix can be edit ./Rakefile (in your app folder)

    and add these lines before calling Rails.application.load_tasks:

    module TempFixForRakeLastComment
      def last_comment
        last_description
      end 
    end
    Rake::Application.send :include, TempFixForRakeLastComment
    

    so entire Rakefile might look like

      require File.expand_path('../config/application', __FILE__)
      require 'rake'
      require 'resque/tasks'
    
    + # temp fix for NoMethodError: undefined method `last_comment'
    + # remove when fixed in Rake 11.x
    + module TempFixForRakeLastComment
    +   def last_comment
    +     last_description
    +   end 
    + end
    + Rake::Application.send :include, TempFixForRakeLastComment
    + ### end of temfix
    + 
      task "resque:preload" => :environment
    
      Rails.application.load_tasks
    

提交回复
热议问题