module Ants::Versions

Public Instance Methods

_document_versions() click to toggle source

returns list of available object versions, requires include Mongoid::History::Trackable to be configured

# File lib/concerns/ants/versions.rb, line 9
def _document_versions
  hash = {}

  history_tracks.only(:created_at, :version).collect do |h|
    hash[h.version] = "Version #{ h.version } — #{ h.created_at }"
  end

  if hash.empty?
    hash = { '' => '--' }
  end

  return hash
end