aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-03-08 11:55:50 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-03-08 11:59:50 -0300
commit8f9c81b15c79903203cd11e51bed5f848e759243 (patch)
tree70d3261657445bb60ad5c1d434752e33fa4f87ad /activerecord/lib/active_record/connection_adapters/abstract
parentad624345e54bd20802de67b2b5c9ef29ecf5d5f4 (diff)
downloadrails-8f9c81b15c79903203cd11e51bed5f848e759243.tar.gz
rails-8f9c81b15c79903203cd11e51bed5f848e759243.tar.bz2
rails-8f9c81b15c79903203cd11e51bed5f848e759243.zip
Make sure options is a hash
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb4
1 files changed, 3 insertions, 1 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 9d624a6648..e2deb6bfcd 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -687,12 +687,14 @@ module ActiveRecord
index_name = index_name(table_name, options)
unless index_name_exists?(table_name, index_name, true)
- if options.has_key? :name
+ if options.is_a?(Hash) && options.has_key?(:name)
options_without_column = options.dup
options_without_column.delete :column
index_name_without_column = index_name(table_name, options_without_column)
+
return index_name_without_column if index_name_exists?(table_name, index_name_without_column, false)
end
+
raise ArgumentError, "Index name '#{index_name}' on table '#{table_name}' does not exist"
end