Skip to content
Browse files

Fix remove_index issue when provided :name is a symbol

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information...
1 parent 19b7123 commit 15fd9a21dc2c172b4a7759fa2b5dac529333ca7e Tim Connor committed with spastorino Sep 27, 2010
View
2 activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -407,7 +407,7 @@ def index_name(table_name, options) #:nodoc:
# as there's no way to determine the correct answer in that case.
def index_name_exists?(table_name, index_name, default)
return default unless respond_to?(:indexes)
- indexes(table_name).detect { |i| i.name == index_name }
+ indexes(table_name).detect { |i| i.name == index_name.to_s }
end
# Returns a string of <tt>CREATE TABLE</tt> SQL statement(s) for recreating the
View
2 activerecord/test/cases/migration_test.rb
@@ -91,7 +91,7 @@ def test_add_index
# Oracle adapter is shortening index name when just column list is given
unless current_adapter?(:OracleAdapter)
assert_nothing_raised { Person.connection.add_index("people", ["last_name", "first_name"]) }
- assert_nothing_raised { Person.connection.remove_index("people", :name => "index_people_on_last_name_and_first_name") }
+ assert_nothing_raised { Person.connection.remove_index("people", :name => :index_people_on_last_name_and_first_name) }
assert_nothing_raised { Person.connection.add_index("people", ["last_name", "first_name"]) }
assert_nothing_raised { Person.connection.remove_index("people", "last_name_and_first_name") }
end

0 comments on commit 15fd9a2

Please sign in to comment.
Something went wrong with that request. Please try again.