-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
Hi,
I am using a rails engine as a component of my rails application. When running the task rake db:mongoid:create_indexes from the main app it doesn't load the inner engine mongoid models.
Currently I am overriding the db:mongoid:load_method rake task and manually load the models I need.
Ideally I should be able to run: {{ Rails::Mongoid.load_models(DomainLogic::Engine)}} in this overridden load_method task.
But there is an issue in lib/rails/mongoid.rb load_models method. When running app.config.paths['app/models'].each it is returning a local path 'app/model'.
If instead you run app.config.paths["app/models"].to_a.each do |path| the returned path would be a full path and would allow to load mongoid files in engines.
What's your take on this? Am I missing some other workaround for this?
Basically I'd like to rely on mongoid index system for my engines models.