Answer the question
In order to leave comments, you need to log in
Why doesn't rails eager_load include classes with the same name but from different namespaces?
Hello.
There is an application and a gem that this application uses.
The gem has the following files
lib/provider1/class_name.rb
module Provider1
class ClassName
...
end
end
module Provider2
class ClassName
...
end
end
Answer the question
In order to leave comments, you need to log in
It seems to me that these directories should not be specified - just the "lib" directory itself is enough, then both classes will be available through their namespaces Provider1::ClassName, Provider2::ClassName. If you specify final directories, then it will load them into ClassName regardless of the namespace and then there will be a mess, because the class names are the same.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question