Remove uses of class_eval with string arguments

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Minor - P4
    • 7.1.0.rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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.

            Assignee:
            Oleg Pudeyev (Inactive)
            Reporter:
            Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: