Skip to content
This repository
Browse code

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

  • Loading branch information...
commit ce5827ea4791e8b8143919ecceb0231e36e8932e 1 parent 8d2f6c1
Pratik lifo authored

Showing 1 changed file with 3 additions and 1 deletion. Show diff stats Hide diff stats

  1. +3 1 activerecord/lib/active_record/schema_dumper.rb
4 activerecord/lib/active_record/schema_dumper.rb
@@ -177,7 +177,9 @@ def indexes(table, stream)
177 177 statment_parts << index.columns.inspect
178 178 statment_parts << (':name => ' + index.name.inspect)
179 179 statment_parts << ':unique => true' if index.unique
180   - statment_parts << (':length => ' + Hash[*index.columns.zip(index.lengths).flatten].inspect) if index.lengths.compact.present?
  180 +
  181 + index_lengths = index.lengths.compact if index.lengths.is_a?(Array)
  182 + statment_parts << (':length => ' + Hash[*index.columns.zip(index.lengths).flatten].inspect) if index_lengths.present?
181 183
182 184 ' ' + statment_parts.join(', ')
183 185 end

0 comments on commit ce5827e

Please sign in to comment.
Something went wrong with that request. Please try again.