KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have encountered following situation: There is ModuleA::ModuleB::ClassC.do_something in the definition of do_something I need to use model from the application def do_something ... data = Order.all ... end But there also exists a module ModuleA::Order So I get an error undefined method `all' for ModuleA::Order:Module I found a solution by doing def do_something ... data = Kernel.const_get('Order').all ... end That returns the model. My question is: what's the best way to do it? is there a cleaner solution? (despite the fact, that having the same name for Class and Module it's not the greatest idea, but it cannot be changed here...)
Tags (comma-separated)
Save Edits
Cancel