1
我试图要求一些模块,我已经写在我的schedule.rake文件里面,但我无法加载文件'LoadError:无法加载这样的文件 - 应用程序/模型/关注/ sharedmethods'如何在rails schedule.rake中包含模块?
什么是我做错了?它是语法吗?
这里是我的schedule.rake
task :some_rake_task => :environment do
require 'app/bot/bot.rb'
require 'app/models/concerns/sharedmethods'
include SharedMethods
#some rake function using methods in SharedMethods
end
可能重复[是否有可能在rake任务中包含模块并使其方法可用于rails应用程序中的任务?](http://stackoverflow.com/questions/17304110/is-it-possible-to -include-modules-in-rake-task-and-make-its-methods-available-fo) – lcguida
@lcguida是的,这是同样的问题,但我仍然有麻烦让它工作..也许因为目录是不正确?如何找出schedule.rake所在的目录? – echan00