Sha256: 28dba60505f6b28903b48535c1adda5b179cc799e7ba42b2f6c677e623d67115
Contents?: true
Size: 650 Bytes
Versions: 46
Compression:
Stored size: 650 Bytes
Contents
require 'active_support/concern' module ResourceRow module TimestampExtensions extend ActiveSupport::Concern def timestamp(attribute_name, options = {}) options.reverse_merge!(format: :short) format = options.delete(:format) column(attribute_name) { |resource| I18n.l(resource.send(attribute_name), format: format) if resource.send(attribute_name).present? } end def timestamps timestamp :created_at timestamp :updated_at end def column_timestamps ActiveSupport::Deprecation.warn('Do not use table.column_timestamps. Use table.timestamps instead!') timestamps end end end
Version data entries
46 entries across 46 versions & 1 rubygems