Sha256: a520c637244cd8f62213db802e650316c696d83bcbd7ceef8d70e0e35c7eb21d
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
module MassInsert module Adapters module Helpers module Timestamp # Returns true o false if the database table has the # timestamp columns. def timestamp? column_names.include?(:created_at) && column_names.include?(:updated_at) end # Returns timestamp format according to the database adapter. This # function can be overwrite in database adapters classes to put the # correct format to that database. def timestamp_format "%Y-%m-%d %H:%M:%S.%6N" end # Returns the timestamp value with specific format according to the # correct timestamp format to that database. def timestamp Time.now.strftime(timestamp_format) end # Returns the timestamp values to be merge into row values that # will be saved in the database. def timestamp_values { :created_at => timestamp, :updated_at => timestamp } end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems