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

Added Rails::Mongoid.preload_models to handle conditional loading of models

    • Type: Icon: Task Task
    • Resolution: Done
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      Added Rails::Mongoid.preload_models to handle conditional loading of models

      This moves the the conditional check for the preload_models config away from
      load_models. Let Rails::Mongoid.load_models load the models as the name implies
      regardless of the config option.

      I ran into a scenario where I needed to load all the models before running a thor task, but there was no easy way to do so, because load_models(app) checked to see if the preload_models config was set or not, and preload_models defaults to false now. This new method handles the conditional check of whether or not to preload models, but the load_models method now loads all models regardless of the config.

            Assignee:
            Unassigned Unassigned
            Reporter:
            rmm5t Ryan McGeary
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: