Module: Rails::Mongoid
- Defined in:
- lib/patches/db_commands.rb
Instance Method Summary collapse
Instance Method Details
#remove_indexes(*globs) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/patches/db_commands.rb', line 61 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 |