I’m trying to call a Model class within a lib/ module with no success.
Here’s what I’m working with:
======================= lib/foo_module.rb ======================
require “pp”
module Foo_Module
def Foo_Module.import_database
barmodel = BarModel.find_all()
end
module ForeignTables
#Unimportant stuff in here
end
end
======================end lib/foo_module.rb ====================
When I try to run “Foo_Module.import_database” in the console, I get
this error:
NameError: uninitialized constant BarModel
BarModel was constructed with the model generator. Any ideas? I feel
like I’m just not referencing BarModel correctly. Should it
Models::BarModel or something?