You can clone with
HTTPS or Subversion.
Models shouldn't be eager-loaded on $rails_rake_task runs. In railtie.rb:
initializer "preload all application models" do |app|
::Rails::Mongoid.load_models(app) unless $rails_rake_task
Dont preload models in rake tasks. Closed by 8fd6d3f. Thank you @dim.
Dont preload models in rake tasks. Closes #387. Thank you @dim.
Out of interest, why should models not be loaded when in a rake task?
I'm a little curious why this is the case too. I added a new initializer to my app that accesses a mongoid model. The rake task will just freeze (actually it'll eventually time out) when you access a model in an initializer. Especially problematic on Heroku, since it will automatically run rake assets:precompile. It'll just time out eventually and the git push will fail.
I'm about to bring this back, since the models actually do need to be loaded for the case above, as well as creating indexes, etc...
Brought back in 2ff10c9