aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract
diff options
context:
space:
mode:
authorÉtienne Barrié <etienne.barrie@gmail.com>2010-09-27 20:59:45 +0200
committerAaron Patterson <aaron.patterson@gmail.com>2010-09-28 10:06:57 -0700
commit8b8730e1390963a8bb3a231ed1a324862d3dc4cf (patch)
tree89ec83c98304d4107ae2f341c4ea155e084c0931 /activerecord/lib/active_record/connection_adapters/abstract
parent9eca11a4a564f44675cca951216e917b8f610eab (diff)
downloadrails-8b8730e1390963a8bb3a231ed1a324862d3dc4cf.tar.gz
rails-8b8730e1390963a8bb3a231ed1a324862d3dc4cf.tar.bz2
rails-8b8730e1390963a8bb3a231ed1a324862d3dc4cf.zip
Test add_index and remove_index with a symbol name #4891
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
index 6c29e67e17..ce6782aac7 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -327,14 +327,12 @@ module ActiveRecord
#
# Note: SQLite doesn't support index length
def add_index(table_name, column_name, options = {})
- options[:name] = options[:name].to_s if options.key?(:name)
-
column_names = Array.wrap(column_name)
index_name = index_name(table_name, :column => column_names)
if Hash === options # legacy support, since this param was a string
index_type = options[:unique] ? "UNIQUE" : ""
- index_name = options[:name] || index_name
+ index_name = options[:name].to_s if options.key?(:name)
else
index_type = options
end
@@ -404,7 +402,8 @@ 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.to_s }
+ index_name = index_name.to_s
+ indexes(table_name).detect { |i| i.name == index_name }
end
# Returns a string of <tt>CREATE TABLE</tt> SQL statement(s) for recreating the