Skip to content

Commit 31f0d52

Browse files
committed
Merge branch 'master' of github.com:ctran/annotate_models
Conflicts: lib/annotate/annotate_models.rb
2 parents 7e2cd42 + 18cd39a commit 31f0d52

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ Gemfile.lock
99
*.gem
1010
/.idea/
1111
.rvmrc
12+
.bundle

lib/annotate/annotate_models.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,8 @@ def get_index_info(klass)
139139
indexes = klass.connection.indexes(klass.table_name)
140140
return "" if indexes.empty?
141141

142-
max_size = indexes.collect{|index| index.name.size}.max || 0
143-
max_size += 1
144-
indexes.each do |index|
142+
max_size = indexes.collect{|index| index.name.size}.max + 1
143+
indexes.sort_by{|index| index.name}.each do |index|
145144
index_info << sprintf("# %-#{max_size}.#{max_size}s %s %s", index.name, "(#{index.columns.join(",")})", index.unique ? "UNIQUE" : "").rstrip + "\n"
146145
end
147146
return index_info

0 commit comments

Comments
 (0)