Skip to content

Commit

Permalink
Make sure schema dumper doesnt throw up when there are no index lengths
Browse files Browse the repository at this point in the history
  • Loading branch information
lifo committed May 9, 2010
1 parent 77adb4b commit 3c1bb40
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion activerecord/lib/active_record/schema_dumper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3c1bb40

Please sign in to comment.