Sha256: c15806dffecd6675638af0ffb1c564c11a3c979ad558af2ab9e0769c5b457c0c
Contents?: true
Size: 503 Bytes
Versions: 10
Compression:
Stored size: 503 Bytes
Contents
module Toy module Timestamps extend ActiveSupport::Concern include Attributes include Callbacks module ClassMethods def timestamps attribute(:created_at, Time) attribute(:updated_at, Time) before_create do |record| now = Time.now record.created_at = now unless created_at? record.updated_at = now end before_update do |record| record.updated_at = Time.now end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems