How do you include modules in rails schedule.rake?

806 views Asked by At

I'm trying to require some modules I've written inside my schedule.rake file but am having trouble loading the file 'LoadError: cannot load such file -- app/models/concerns/sharedmethods'

What am I doing wrong? Is it the syntax?

Here is my 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
1

There are 1 answers

0
echan00 On

It seemed like this solved the initial problem:

require "#{Rails.root}/app/bot/bot.rb"

But bot.rb has:

require "orderbot"

And I had to change all the follow require statements to:

require "#{Rails.root}/app/bot/orderbot.rb"