aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-04-09 14:53:21 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-04-09 14:59:11 +0900
commit1d05e64b6dc5ba4ed1e21dd2975dcd7faf36795d (patch)
tree564a06ff9b1695a0a0a77f52372b9434603a3a20 /activerecord/lib/active_record
parent3b5a6dfb18f33c373a89760c60d741f34206f23b (diff)
downloadrails-1d05e64b6dc5ba4ed1e21dd2975dcd7faf36795d.tar.gz
rails-1d05e64b6dc5ba4ed1e21dd2975dcd7faf36795d.tar.bz2
rails-1d05e64b6dc5ba4ed1e21dd2975dcd7faf36795d.zip
Tweaks #28678
* Fix the comment on `formatted_version` * Extract `define_params` * Remove duplicated guard clause for `@version`
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/schema_dumper.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb
index 657bd43b86..94d63765c9 100644
--- a/activerecord/lib/active_record/schema_dumper.rb
+++ b/activerecord/lib/active_record/schema_dumper.rb
@@ -47,17 +47,18 @@ module ActiveRecord
@options = options
end
- # turns 20170404131909 into "2017_04_04131909"
+ # turns 20170404131909 into "2017_04_04_131909"
def formatted_version
- return "" unless @version
stringified = @version.to_s
return stringified unless stringified.length == 14
stringified.insert(4, "_").insert(7, "_").insert(10, "_")
end
- def header(stream)
- define_params = @version ? "version: #{formatted_version}" : ""
+ def define_params
+ @version ? "version: #{formatted_version}" : ""
+ end
+ def header(stream)
stream.puts <<HEADER
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to