Sha256: 62f30fb1bc157478d83787fc1e2125dbc0001115f38ed7e51e19c6e6786bb67c
Contents?: true
Size: 904 Bytes
Versions: 5
Compression:
Stored size: 904 Bytes
Contents
# frozen_string_literal: true module SuperSettings module Storage class ActiveRecordStorage # Base class that the models extend from. class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end class Model < ApplicationRecord self.table_name = "super_settings" has_many :history_items, class_name: "SuperSettings::Storage::ActiveRecordStorage::HistoryModel", foreign_key: :key, primary_key: :key end class HistoryModel < ApplicationRecord self.table_name = "super_settings_histories" # Since these models are created automatically on a callback, ensure that the data will # fit into the database columns since we can't handle any validation errors. before_validation do self.changed_by = changed_by.to_s[0, 150] if changed_by.present? end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems