Sha256: f016de18dac0139f5fb94344251255e00db1cc6437a39432dd38f7ac93f03449
Contents?: true
Size: 613 Bytes
Versions: 8
Compression:
Stored size: 613 Bytes
Contents
module Pupa module Concerns # Adds the Popolo `created_at` and `updated_at` properties to a model. The # `created_at` and `updated_at` properties will automatically be set when # the object is inserted into or updated in the database. module Timestamps extend ActiveSupport::Concern included do attr_accessor :created_at, :updated_at set_callback(:create, :before) do |object| object.created_at = Time.now.utc end set_callback(:save, :before) do |object| object.updated_at = Time.now.utc end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems