diff options
author | lsylvester <lachlan.sylvester@hypothetical.com.au> | 2018-10-17 10:48:11 -0500 |
---|---|---|
committer | schneems <richard.schneeman+foo@gmail.com> | 2018-10-17 11:06:08 -0500 |
commit | 73f9cd2da452c97061a7b01d3d8e9f480950fe80 (patch) | |
tree | 8bd0934a933319102909f90f8f0b4cc09b09cf59 /activerecord/lib/active_record | |
parent | 2f99da00c7b311af0bc5969985eee97937790e4f (diff) | |
download | rails-73f9cd2da452c97061a7b01d3d8e9f480950fe80.tar.gz rails-73f9cd2da452c97061a7b01d3d8e9f480950fe80.tar.bz2 rails-73f9cd2da452c97061a7b01d3d8e9f480950fe80.zip |
Prefer String#ljust over String#<< for padding
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/integration.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/integration.rb b/activerecord/lib/active_record/integration.rb index db7200bceb..04d0d46d3e 100644 --- a/activerecord/lib/active_record/integration.rb +++ b/activerecord/lib/active_record/integration.rb @@ -193,9 +193,8 @@ module ActiveRecord # to account for this we pad the output with zeros def raw_timestamp_to_cache_version(timestamp) key = timestamp.delete("- :.") - padding = 20 - key.length - if padding != 0 - key << "0" * padding + if key.length < 20 + key.ljust(20, "0") else key end |