Sha256: 433105142132a7cad0d3a8120087530b664dc73c6f849cce77bd048d12b7e178
Contents?: true
Size: 848 Bytes
Versions: 33
Compression:
Stored size: 848 Bytes
Contents
# == Schema Information # # Table name: secrets # # id :bigint not null, primary key # version :integer # secret :text(65535) # name :string(255) # created_at :datetime not null # updated_at :datetime not null # class Secret < RailsBase::ApplicationRecord class << self def update(name:, secret:) next_version = get_secrets(name: name).select(:version).last&.version || 0 next_version += 1 # always increase the version instance = new(version: next_version, name: name, secret: secret) instance.save! instance end def get_current_secret(name:) get_secrets(name: name).last end def get_secret_range(name:, range: [-2..-1]) where(name: name)[*range] end def get_secrets(name:) where(name: name) end end end
Version data entries
33 entries across 33 versions & 1 rubygems