3 ms·
Sure, I'll give it a shot. Ruby classes usually need to explicitly require the other classes and modules which they use. Rails implemented a different way to a
by Dangeranger 7y ago
Sure, I'll give it a shot.
Ruby classes usually need to explicitly require the other classes and modules which they use. Rails implemented a different way to achieve requiring dependencies using a method called "const_missing" which requires the missing dependent when it is not found in the known constant list.
The problem with this is that if your classes and modules do not adhere to a strict arrangement within your source code directories then Rails can sometimes not find the file you are looking for, or worse find the wrong file.
Since "require" has an effect on the loaded constant namespace, the order of requiring dependencies can make a difference in the presence of bugs related to which code has been required.
There's more information here: https://github.com/fxn/zeitwerk#motivation https://github.com/fxn/zeitwerk#motivation