aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/schema_dumper.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2016-08-23 09:19:15 +0900
committerRyuta Kamizono <kamipo@gmail.com>2016-08-23 17:49:20 +0900
commit28625dbb8190bce19dad2fd6d2b689a92cac5733 (patch)
tree6fe74e572c7bb7397d52d5f6e1aa7a689e83661e /activerecord/lib/active_record/schema_dumper.rb
parent58e0b1d6fc5b6762fbe667c24d808d76b57c7914 (diff)
downloadrails-28625dbb8190bce19dad2fd6d2b689a92cac5733.tar.gz
rails-28625dbb8190bce19dad2fd6d2b689a92cac5733.tar.bz2
rails-28625dbb8190bce19dad2fd6d2b689a92cac5733.zip
Remove unnecessary `format_string`
`format_string` is used for standardized column types/arguments spaces. Now the standardization was removed at df84e9867219e9311aef6f4efd5dd9ec675bee5c.
Diffstat (limited to 'activerecord/lib/active_record/schema_dumper.rb')
-rw-r--r--activerecord/lib/active_record/schema_dumper.rb17
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)