-
Type: Improvement
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
Currently Mongoid uses class_eval with a string in a number of places. This was probably done in the days of much older Ruby versions that did not have modern class_eval/module_eval methods/semantics. The string evaluation has two issues:
1. It is more difficult to debug, because the evaled code is in its own scope.
2. The fact that a string is evaluated can cause problems if the variables that are expanded have unexpected contents.
Additionally, Mongoid appears to have an implementation of delegator pattern which is also unnecessary since both Ruby standard library and ActiveSupport provide usable implementations.