Permalink
Browse files

Make sure schema dumper doesnt throw up when there are no index lengths

  • Loading branch information...
1 parent 77adb4b commit 3c1bb40b6b0b611ba068c2e5375cbcc400c40507 @lifo lifo committed May 9, 2010
Showing with 3 additions and 1 deletion.
  1. +3 −1 activerecord/lib/active_record/schema_dumper.rb
@@ -170,7 +170,9 @@ def indexes(table, stream)
statment_parts << index.columns.inspect
statment_parts << (':name => ' + index.name.inspect)
statment_parts << ':unique => true' if index.unique
- statment_parts << (':length => ' + Hash[*index.columns.zip(index.lengths).flatten].inspect) if index.lengths.compact.present?
+
+ index_lengths = index.lengths.compact if index.lengths.is_a?(Array)
+ statment_parts << (':length => ' + Hash[*index.columns.zip(index.lengths).flatten].inspect) if index_lengths.present?
' ' + statment_parts.join(', ')
end

0 comments on commit 3c1bb40

Please sign in to comment.