diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-08-23 22:36:12 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-23 22:36:12 -0300 |
commit | 3df9876a2468856f428897332af32f440f0737e1 (patch) | |
tree | 7a5ad1ddff43bf8d3bcf653a662b28f3ee180254 /activerecord | |
parent | 6119b022cf55ee0a59546310f1fd2cc92d4fbe60 (diff) | |
parent | 28625dbb8190bce19dad2fd6d2b689a92cac5733 (diff) | |
download | rails-3df9876a2468856f428897332af32f440f0737e1.tar.gz rails-3df9876a2468856f428897332af32f440f0737e1.tar.bz2 rails-3df9876a2468856f428897332af32f440f0737e1.zip |
Merge pull request #26258 from kamipo/remove_unnecessary_format_string
Remove unnecessary `format_string`
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/schema_dumper.rb | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index b65d5b56f1..ab2d64e903 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -145,22 +145,9 @@ HEADER # find all migration keys used in this table keys = @connection.migration_keys - # figure out the lengths for each column based on above keys - lengths = [0] * keys.length - - # the string we're going to sprintf our values against, with standardized column widths - format_string = ["%s"] * keys.length - - # add column type definition to our format string - format_string.unshift " t.%s " - - format_string *= "" - column_specs.each do |colspec| - values = keys.zip(lengths).map { |key, len| colspec.key?(key) ? colspec[key] + ", " : " " * len } - values.unshift colspec[:type] - tbl.print((format_string % values).gsub(/,\s*$/, "")) - tbl.puts + values = keys.map { |key| colspec[key] }.compact + tbl.puts " t.#{colspec[:type]} #{values.join(", ")}" end indexes_in_create(table, tbl) |