module Rails::Mongoid

Mongoid utilities for Rails

Public Instance Methods

load_models(app) click to toggle source

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.

@example Load all the application models.

Rails::Mongoid.load_models(app)

@param [ Application ] app The rails application.

# File lib/rails/mongoid.rb, line 18
def load_models(app)
  ::Mongoid.load_models(app.config.paths["app/models"].expanded)
end
preload_models(app) click to toggle source

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

@param [ Application ] app The rails application.

# File lib/rails/mongoid.rb, line 26
def preload_models(app)
  load_models(app) if ::Mongoid.preload_models
end