Sha256: a6d97d3623f9a70bc832779e28556835c9916b4133d720c2d3664972cb6d8936

Contents?: true

Size: 307 Bytes

Versions: 10

Compression:

Stored size: 307 Bytes

Contents

module Ohm
  module Timestamping
    def self.included(base)
      base.attribute :created_at
      base.attribute :updated_at
    end

    def create
      self.created_at ||= Time.now.utc

      super
    end

  protected
    def write
      self.updated_at ||= Time.now.utc

      super
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ohm-contrib-0.0.14 lib/ohm/contrib/timestamping.rb
ohm-contrib-0.0.13 lib/ohm/contrib/timestamping.rb
ohm-contrib-0.0.12 lib/ohm/contrib/timestamping.rb
ohm-contrib-0.0.11 lib/ohm/contrib/timestamping.rb
ohm-contrib-0.0.10 lib/ohm/contrib/timestamping.rb
ohm-contrib-0.0.9 lib/ohm/contrib/timestamping.rb
ohm-contrib-0.0.8 lib/ohm/contrib/timestamping.rb
ohm-contrib-0.0.7 lib/ohm/contrib/timestamping.rb
ohm-contrib-0.0.6 lib/ohm/contrib/timestamping.rb
ohm-contrib-0.0.5 lib/ohm/contrib/timestamping.rb