提交 d6f7b7d3 编写于 作者: T Tim Connor 提交者: Santiago Pastorino

Fix remove_index issue when provided :name is a symbol

Signed-off-by: NSantiago Pastorino <santiago@wyeworks.com>
上级 56de4e9a
......@@ -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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册