Sha256: f8df78875ce7b4915d0a12b01900467430bb5ad57b2e6c131103226e2b6eeea3
Contents?: true
Size: 457 Bytes
Versions: 14
Compression:
Stored size: 457 Bytes
Contents
module Toy module Timestamps extend ActiveSupport::Concern 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
14 entries across 14 versions & 1 rubygems