Reputation: 1517
I am having a clockwork configuration file(inside the lib folder) that queues another file's methods to perform delayed tasks.
require_relative "Adwords/Extractor"
It is working fine on my local machine (WEBrick running on win8). However on heroku, it is failing with the following error:
'app[web.1]: /app/lib/clock.rb:5:in `require_relative': cannot load such file -- /app/li
b/Adwords/Extractor (LoadError)'
The Extractor.rb script is located at the same place as mentioned by the error statement.
Upvotes: 1
Views: 285
Reputation: 7225
try this out
require "#{Rails.root}/app/lib/Adwords/Extractor"
use relative path to rails app.
Upvotes: 1
Reputation: 475
In Ruby 1.9.2 or higher no longer make the current directory . part of your LOAD_PATH.
You can get around it by using absolute paths
File.expand_path(__FILE__) et al
or doing
require './filename' (ironically).
or by using
require_relative 'filename'
require './filename'
only works if your script is executed with the working directory set to the same directory that the script resides. This is often not the case in multi-directory projects.
Upvotes: 1