Skip to content

Commit

Permalink
Fix remove_index issue when provided :name is a symbol
Browse files Browse the repository at this point in the history
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
  • Loading branch information
Tim Connor authored and spastorino committed Sep 26, 2010
1 parent 56de4e9 commit d6f7b7d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -404,7 +404,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
Expand Down
2 changes: 1 addition & 1 deletion activerecord/test/cases/migration_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit d6f7b7d

Please sign in to comment.