diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-11-02 18:58:27 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-11-02 19:00:58 -0200 |
commit | 8fc52706c376be03f644e847d1dd357fc88ead6f (patch) | |
tree | 90d5ba3565ef3b125144b5c65111930f2cb19cbe /activerecord/lib/active_record | |
parent | 48a7a261c2e461ecab738d061c31a7dece699d97 (diff) | |
download | rails-8fc52706c376be03f644e847d1dd357fc88ead6f.tar.gz rails-8fc52706c376be03f644e847d1dd357fc88ead6f.tar.bz2 rails-8fc52706c376be03f644e847d1dd357fc88ead6f.zip |
Raise an ArgumentError when passing an invalid option to add_index
Closes #8104
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb | 5 |
1 files changed, 4 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 8790518d37..a606a5c775 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb @@ -617,11 +617,14 @@ module ActiveRecord def add_index_options(table_name, column_name, options = {}) column_names = Array(column_name) - index_name = index_name(table_name, :column => column_names) + index_name = index_name(table_name, column: column_names) if Hash === options # legacy support, since this param was a string + options.assert_valid_keys(:unique, :order, :name, :where, :length) + index_type = options[:unique] ? "UNIQUE" : "" index_name = options[:name].to_s if options.key?(:name) + if supports_partial_index? index_options = options[:where] ? " WHERE #{options[:where]}" : "" end |