Module: Rails::Mongoid
- Defined in:
- lib/patches/db_commands.rb
Instance Method Summary collapse
Instance Method Details
#remove_indexes(*globs) ⇒ Object
88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/patches/db_commands.rb', line 88 def remove_indexes(*globs) models(*globs).each do |model| next if model. begin indexes = model.collection.indexes.map{ |doc| doc["name"] } indexes.delete_one("_id_") model.remove_indexes rescue Moped::Errors::OperationFailure next end logger.info("MONGOID: Removing indexes on: #{model} for: #{indexes.join(', ')}.") model end.compact end |