123456789_123456789_123456789_123456789_123456789_

Module: Rails::Mongoid

Relationships & Source Files
Namespace Children
Classes:
Defined in: lib/rails/mongoid.rb,
lib/mongoid/railtie.rb

Overview

Mongoid utilities for ::Rails

Instance Method Summary

  • #load_models(app)

    Use the application configuration to get every model and require it, so that indexing and inheritance work in both development and production with the same results.

  • #preload_models(app)

    Conditionally calls ‘Rails::Mongoid.load_models(app)` if the ::Mongoid.preload_models is true.

Instance Method Details

#load_models(app)

Use the application configuration to get every model and require it, so that indexing and inheritance work in both development and production with the same results.

Examples:

Load all the application models.

Rails::Mongoid.load_models(app)

Parameters:

  • app (Application)

    The rails application.

[ GitHub ]

  
# File 'lib/rails/mongoid.rb', line 18

def load_models(app)
  ::Mongoid.load_models(app.config.paths["app/models"].expanded)
end

#preload_models(app)

Conditionally calls ‘Rails::Mongoid.load_models(app)` if the ::Mongoid.preload_models is true.

Parameters:

  • app (Application)

    The rails application.

[ GitHub ]

  
# File 'lib/rails/mongoid.rb', line 26

def preload_models(app)
  load_models(app) if ::Mongoid.preload_models
end