Sha256: 038ec8af04c750600a50b2b14d255f0e505ca95abb8ee9ac5248f37f0c3b2c54

Contents?: true

Size: 521 Bytes

Versions: 22

Compression:

Stored size: 521 Bytes

Contents

module Ants
  module Versions
    extend ActiveSupport::Concern

    included do

      # returns list of available object versions, requires
      # include Mongoid::History::Trackable to be configured
      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

    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
ants-0.2.0 lib/concerns/ants/versions.rb
ants-0.1.4 lib/concerns/ants/versions.rb