mongoid/mongoid

View on GitHub
lib/mongoid/timestamps/updated/short.rb

Summary

Maintainability
A
0 mins
Test Coverage
# encoding: utf-8
module Mongoid
  module Timestamps
    module Updated

      # Adds an updated_at timestamp to the document, but it is stored as u_at
      # with an updated_at alias.
      module Short
        extend ActiveSupport::Concern

        included do
          include Updated
          fields.delete("updated_at")
          field :u_at, type: Time, as: :updated_at
        end
      end
    end
  end
end