I have a status module that exists in a directory structure: lib / stat_creator / stat /
In lib / stat_creator / stat.rb I have the files in the lib / stat_creator / stat / directory that I need, as well as:
module StatCreator module Stat end end
When I use this module, I treat classes as
StatCreator::Stat::Foo.new
Now I need the root class Stat, which lives in the application. I made my Stat class in application / models and configured it on route.rb. But if I go to the rails console and try to use the Stat class in the application / models, for example:
Stat.by_user_id("ID")
I get the error: LoadError: Expected ../ lib / stat_creator / stat.rb for determining Stat
I thought that using a namespace was supposed to avoid such a conflict, so I do not understand what I'm doing wrong.
source share