Index: lib/auto_migrations.rb =================================================================== --- lib/auto_migrations.rb (revision 413) +++ lib/auto_migrations.rb (working copy) @@ -104,12 +104,15 @@ def auto_add_index(method, *args, &block) table_name = args.shift.to_s fields = Array(args.shift).map(&:to_s) - index_name = "index_#{table_name}_on_#{fields.join('_and_')}" - + options = args.shift + + index_name = options[:name] if options + index_name ||= "index_#{table_name}_on_#{fields.join('_and_')}" + (self.indexes_in_schema ||= []) << index_name unless ActiveRecord::Base.connection.indexes(table_name).detect { |i| i.name == index_name } - method_missing_without_auto_migration(method, *[table_name, fields], &block) + method_missing_without_auto_migration(method, *[table_name, fields, options], &block) end end