Method: Mongoid::Tasks::Database#create_collections
- Defined in:
- lib/mongoid/tasks/database.rb
#create_collections(models = ::Mongoid.models, force: false) ⇒ Object
Create collections for each model given the provided globs and the class is not embedded.
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/mongoid/tasks/database.rb', line 21 def create_collections(models = ::Mongoid.models, force: false) models.each do |model| if !model. || model.cyclic? model.create_collection(force: force) logger.info("MONGOID: Created collection for #{model}:") else logger.info("MONGOID: collection options ignored on: #{model}, please define in the root model.") end rescue Exception logger.error "error while creating collection for #{model}" raise end end |