Skip to content

Commit aef0766

Browse files
committed
Merge pull request #201 from andys/develop
sort simple_index indexes by name
2 parents dafd953 + a1ee542 commit aef0766

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/annotate/annotate_models.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def get_schema_info(klass, header, options = {})
151151
if options[:simple_indexes] && klass.table_exists?# Check out if this column is indexed
152152
indices = klass.connection.indexes(klass.table_name)
153153
if indices = indices.select { |ind| ind.columns.include? col.name }
154-
indices.each do |ind|
154+
indices.sort_by{|ind| ind.name}.each do |ind|
155155
ind = ind.columns.reject! { |i| i == col.name }
156156
attrs << (ind.length == 0 ? "indexed" : "indexed => [#{ind.join(", ")}]")
157157
end

0 commit comments

Comments
 (0)