|
Ever used default_scope in RoR? Ever regretted you had ever read about this feature after you wrote tons of code and later realized you can’t access the records you need in a convenient way when necessary? Try googling “how to override default_scope” and you will find tons of advices how to do it with model.send(:with_exclusive_scope) { super }, but no real way how to cancel it completely for a model when you really need it (like in tests for instance). Here is a simple solution and a few advices regarding this misfeature:
Read More
|