Cannot use Mongoid documents as Rails cache keys with Mongoid 7

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Unknown
    • None
    • Affects Version/s: 7.5.3
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      There is an infinite loop happening when we try to cache a Mongoid model instance. 

      Steps to Reproduce 👣

      1. Setup a simple Mongoid Class

       

      class Project
        include Mongoid::Document
        
        field :name, type: String
      end
       

      2. Try to cache that model instance

      project = Project.new(name: 'Oi')
      Rails.cache.fetch(project) 

      3. An infinite loop happens, raising the SystemStackError exception, as we can see below

       

              Assignee:
              Dmitry Rybakov
              Reporter:
              Victor Costa
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: