rails/rails — pull request #10010 by pwnall (2013-03-31 08:38:41+00:00)
Title: Make references with index:true pass Hash options to add_index

The definition for `ActiveRecord::ConnectionAdapters::SchemaStatements::TableDefinition#add_index` looks like

```ruby
add_index(table_name, column_name, options = {})
```

This can lead plugin writers to assume that `options` will always be a Hash, which has worked well so far.

This change makes the assumption hold when `TableDefinition#references` receives an `index` option set to `true`. I think the few extra hashes created during migrations are well worth not breaking 3rd-party code that relies on the Hash assumption, and I hope that you will agree with me.

Example of broken plugin: https://github.com/dazuma/activerecord-postgis-adapter/pull/60

I hope the test I added is alright, and I'll be happy to change it based on feedback.