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

Cannot use Mongoid documents as Rails cache keys with Mongoid 7

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

      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@mongodb.com Dmitry Rybakov
            Reporter:
            victorcorcos@gmail.com Victor Costa
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: