views:

22

answers:

1

What is the best way to set up an index or configure a capped collections in a Rails project?

From what I've found, it seems that a good way would be to keep this configuration in an initializer.

The command for setting up an index is ModelName.ensure_index :key, but what is the command for a capped collection?

+1  A: 

Just drop down to the ruby driver to create the collection.

http://api.mongodb.org/ruby/1.0.7/Mongo/DB.html#create_collection-instance_method

Foo.database.create_collection(:foo, :capped => true)

Do that in an initializer or something.

jnunemaker