instance method
raw_timestamp_to_cache_version
Ruby on Rails 7.1.6
Since v6.0.6 PrivateSignature
raw_timestamp_to_cache_version(timestamp)
Converts a raw database string to :usec format.
Example:
timestamp = "2018-10-15 20:02:15.266505" raw_timestamp_to_cache_version(timestamp) # => "20181015200215266505"
PostgreSQL truncates trailing zeros, github.com/postgres/postgres/commit/3e1beda2cde3495f41290e1ece5d544525810214 to account for this we pad the output with zeros
Parameters
-
timestampreq
Source
# File activerecord/lib/active_record/integration.rb, line 197
def raw_timestamp_to_cache_version(timestamp)
key = timestamp.delete("- :.")
if key.length < 20
key.ljust(20, "0")
else
key
end
end
Defined in activerecord/lib/active_record/integration.rb line 197
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Integration