Sha256: 6b203579c74cd14fd2ae373c4faa4e7db3d1bc477f0769e6455eac7ce099287e

Contents?: true

Size: 811 Bytes

Versions: 2

Compression:

Stored size: 811 Bytes

Contents

# See http://groups.google.com/group/mongomapper/browse_thread/thread/68f62e8eda43b43a/4841dba76938290c
#
# to_prepare is called before each request in development mode and the first request in production.
Rails.configuration.to_prepare do
  if !Rails.configuration.cache_classes
    # Rails reloading was making descendants fill up and leak memory, these make sure they get cleared
    MongoMapper::Document.descendants.each {|m| m.descendants.clear if m.respond_to?(:descendants) }
    MongoMapper::Document.descendants.clear
    MongoMapper::EmbeddedDocument.descendants.each {|m| m.descendants.clear if m.respond_to?(:descendants) }
    MongoMapper::EmbeddedDocument.descendants.clear
    MongoMapper::Plugins::IdentityMap.models.clear
  end
end

config.middleware.use 'MongoMapper::Middleware::IdentityMap'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ign-mongo_mapper-0.8.6.2 rails/init.rb
ign-mongo_mapper-0.8.6.1 rails/init.rb