Skip to content

Commit b5a201d

Browse files
bousquetctran
authored andcommitted
Coerce string index.columns to Array before join (#378)
1 parent d159c70 commit b5a201d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/annotate/annotate_models.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,9 @@ def get_index_info(klass, options={})
300300
max_size = indexes.collect{|index| index.name.size}.max + 1
301301
indexes.sort_by(&:name).each do |index|
302302
if options[:format_markdown]
303-
index_info << sprintf("# * `%s`%s:\n# * **`%s`**\n", index.name, index.unique ? " (_unique_)" : "", index.columns.join("`**\n# * **`"))
303+
index_info << sprintf("# * `%s`%s:\n# * **`%s`**\n", index.name, index.unique ? " (_unique_)" : "", Array(index.columns).join("`**\n# * **`"))
304304
else
305-
index_info << sprintf("# %-#{max_size}.#{max_size}s %s %s", index.name, "(#{index.columns.join(",")})", index.unique ? "UNIQUE" : "").rstrip + "\n"
305+
index_info << sprintf("# %-#{max_size}.#{max_size}s %s %s", index.name, "(#{Array(index.columns).join(",")})", index.unique ? "UNIQUE" : "").rstrip + "\n"
306306
end
307307
end
308308

0 commit comments

Comments
 (0)