1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #26688 from kamipo/remove_respond_to_indexes

Remove unnecessary `respond_to?(:indexes)` checking
This commit is contained in:
Kasper Timm Hansen 2016-10-28 13:46:06 +02:00 committed by GitHub
commit 86bf5adaa8
2 changed files with 8 additions and 17 deletions

View file

@ -1199,10 +1199,6 @@ module ActiveRecord
def index_name_for_remove(table_name, options = {})
return options[:name] if can_remove_index_by_name?(options)
# if the adapter doesn't support the indexes call the best we can do
# is return the default index name for the options provided
return index_name(table_name, options) unless respond_to?(:indexes)
checks = []
if options.is_a?(Hash)

View file

@ -72,7 +72,6 @@ module ActiveRecord
def test_indexes
idx_name = "accounts_idx"
if @connection.respond_to?(:indexes)
indexes = @connection.indexes("accounts")
assert indexes.empty?
@ -82,10 +81,6 @@ module ActiveRecord
assert_equal idx_name, indexes.first.name
assert !indexes.first.unique
assert_equal ["firm_id"], indexes.first.columns
else
warn "#{@connection.class} does not respond to #indexes"
end
ensure
@connection.remove_index(:accounts, name: idx_name) rescue nil
end