Open werbitzky opened 10 years ago
It seems to be that the only way to do what you want is to manually try to Dir.glob all possible model directories, like rails_admin does https://github.com/sferik/rails_admin/blob/master/lib/rails_admin/config.rb#L307
I currently do not want to do that, as it's far from perfect in rails_admin.
Will leave this issue open for now.
This task should work with no problems in production, or if you manually require or require_dependency the models before it.
I agree that the Dir.glob solution is far from perfect
a quickfix for me was to manually add an initializer file that initializes the elasticsearch indexed models and thus makes the gem aware of them before executing the task
for example, if I had a "Product" and an "Offer" model I would just invoke their class constant in the initializer file like this
Offer
Product
thank you for this nice gem by the way!
+1 It would be awesome to find a workaround !
the comand rake es:reindex does not work for me (rails 4.1.4, mongoid 4.0.0rc2) the problem seems to be, that the models are not loaded before executing the task, so there are no registered models, i.e. Mongoid::Elasticsearch.registered_models is an empty array