Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4850

"delegate" is broken when using Rails

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 7.1.0
    • Component/s: None
    • Labels:
      None

      Starting with version 7.1.0, MongoID models can no longer utilize Rails' delegate method. Attempting to call the method results in an ArgumentError.

      I inspected this issue a little further and it turned out that delegate no longer refers to the Rails' method but to Ruby's built-in Forwardable module.

      Rails' Module#delegate and Ruby's Forwardable#delegate have different semantics and cannot be used interchangeably.

      If I'm not mistaken, this is due to https://github.com/mongodb/mongoid/commit/3cfabfd2e41c8e3738aa6e381b9113d89275f2f5 which added the Forwardable module to MongoID.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            mail@stefanschuessler.de Stefan Schüßler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: