Commit 31f0d524 by Alex Chaffee

Merge branch 'master' of github.com:ctran/annotate_models

Conflicts: lib/annotate/annotate_models.rb
parents 7e2cd422 18cd39ad
......@@ -9,3 +9,4 @@ Gemfile.lock
*.gem
/.idea/
.rvmrc
.bundle
......@@ -139,9 +139,8 @@ module AnnotateModels
indexes = klass.connection.indexes(klass.table_name)
return "" if indexes.empty?
max_size = indexes.collect{|index| index.name.size}.max || 0
max_size += 1
indexes.each do |index|
max_size = indexes.collect{|index| index.name.size}.max + 1
indexes.sort_by{|index| index.name}.each do |index|
index_info << sprintf("# %-#{max_size}.#{max_size}s %s %s", index.name, "(#{index.columns.join(",")})", index.unique ? "UNIQUE" : "").rstrip + "\n"
end
return index_info
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment