Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

remove_index silently fails when passed a symbol as the index name

#5711

When removing an index, if a symbol is used for the index name the removal silently fails.

remove_index :my_table, :name => 'my_index_name'

works but

remove_index :my_table, :name => :my_index_name

does not work. The index removal fails because SchemaStatements#index_name_exists? uses == without first calling to_s on the passed name, so it compares a string with a symbol.

The issue is compounded by the swallowing of the exception, however this has since been fixed by http://github.com/rails/rails/commit/37de59eacf8f6478e866309615af73...

I have attached a patch to fix the problem

Reported by Tim Connor · September 26th, 2010 @ 11:57 PM

State: committed
Milestone: 3.0.2
Assigned to: Santiago Pastorino Santiago Pastorino
Importance: Low

Activity

  1. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to committed
    • Milestone cleared.
    • Assigned user set to Santiago Pastorino
    • Importance changed from to Low

    September 27th, 2010 @ 12:42 AM

  2. Jeremy Kemper