[英]NoMethodError: undefined method `task' for Sinatra::Application:Class
This is the error I get when I run any rake command: undefined method 'task' for Sinatra::Application:Class这是我运行任何 rake 命令时得到的错误:Sinatra::Application:Class 的未定义方法“任务”
# Rakefile
require 'sinatra/activerecord'
require 'sinatra/activerecord/rake'
require_relative './config/environment'
Dir.glob('lib/tasks/*.rake').each { |r| load r}
#lib/tasks/test_report.rake
namespace :test_report do
task :generate => :environment do
...
end
end
I run into the above error when I tried to run the command.当我尝试运行命令时遇到了上述错误。
bundle exec rake test_report:generate
You're trying to use rake API, but it's not loaded.您正在尝试使用 rake API,但未加载。 Add this on top of your file.
将此添加到您的文件顶部。
require 'rake'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.