mongoid/mongoid — Issue #1592: rake db:mongoid:create_indexes never fails
Author: Mange
Created: 2012-01-13 15:27:46+00:00
State: open

If any model have an invalid index specification, the db:mongoid:create_indexes task should fail, but it never does.

```
$ rake db:mongoid:create_indexes; echo $?
ERROR: Invalid index field nil; should be one of Mongo::ASCENDING (1), Mongo::DESCENDING (-1) or Mongo::GEO2D ('2d').
0
```

When this task is used as a part of a migration, the migration does not cancel and the error just disappears. Failing rake tasks should fail with a non-zero exit code and cancel all following tasks from executing.