Sha256: 4b01b906df19ee361fcd7d18358bdc61020768734c23e23c87ddba48a2fa2e32

Contents?: true

Size: 468 Bytes

Versions: 1

Compression:

Stored size: 468 Bytes

Contents

module Hist
  class Version < Hist::ApplicationRecord

    self.table_name = "hist_versions"

    def self.put(obj:, user: nil, extra: nil)
      # Trim old versions
      # TODO: make this more efficient
      if obj.class.base_class.hist_config.max_versions >= 0
        versions = self.raw_get(obj: obj)
        if versions.size >= obj.class.base_class.hist_config.max_versions
          versions.last.destroy!
        end
      end

      super
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hist-0.2.0 app/models/hist/version.rb