Reputation: 5735
What is the correct way to reference a require
in Ruby on Rails?
error:
LoadError: cannot load such file 'lib/appname/loader/model_import'
Rake Task:
require 'csv'
require 'lib/appname/loader/model_import'
namespace :app_name do
namespace :loader do
desc "Loads data into Database"
task model_import: :environment do
include AppName::Loader::ModelImport
end
end
end
Upvotes: 0
Views: 1417
Reputation: 5871
require
is used to import a library or module that has been installed properly.
If you're trying to access something in the same directory or internal to a library or project, then try using require_relative
Upvotes: 4