mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Fix remove_index issue when provided :name is a symbol
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
This commit is contained in:
committed by
Santiago Pastorino
parent
56de4e9a80
commit
d6f7b7d353
@@ -404,7 +404,7 @@ module ActiveRecord
|
||||
# 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
|
||||
|
||||
@@ -91,7 +91,7 @@ if ActiveRecord::Base.connection.supports_migrations?
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user