Skip to content
Extraits de code Groupes Projets
clear_dev_memory.rb 589 octets
Newer Older
  • Learn to ignore specific revisions
  • Raphael's avatar
    Raphael a validé
    #   Copyright (c) 2010, Diaspora Inc.  This file is
    
    Raphael's avatar
    Raphael a validé
    #   licensed under the Affero General Public License version 3.  See
    #   the COPYRIGHT file.
    
    Raphael's avatar
    Raphael a validé
      class ClearDevMemory
    
        def initialize(app)
          @app = app
        end
    
        def call(env)
          if Rails.configuration.cache_classes
          else
            MongoMapper::Document.descendants.each do |m|
              m.descendants.clear if m.respond_to? :descendants
            end
            MongoMapper::Document.descendants.clear
            MongoMapper::EmbeddedDocument.descendants.clear
          end
          @app.call(env)
        end
      end
    end