diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-05-09 12:42:15 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-05-09 12:43:06 +0100 |
commit | ce5827ea4791e8b8143919ecceb0231e36e8932e (patch) | |
tree | 1198a01ce536743b2b53f95f3c7649d76bc7e294 /activerecord | |
parent | 8d2f6c16e381f5fff6d3f24f5c73a443577a1488 (diff) | |
download | rails-ce5827ea4791e8b8143919ecceb0231e36e8932e.tar.gz rails-ce5827ea4791e8b8143919ecceb0231e36e8932e.tar.bz2 rails-ce5827ea4791e8b8143919ecceb0231e36e8932e.zip |
Make sure schema dumper doesnt throw up when there are no index lengths
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/schema_dumper.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index 5cb639a300..cd54653581 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -177,7 +177,9 @@ HEADER 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 |