Files
fizzy/app/models/account/entropy.rb
T
Jorge Manrubia 91787a3523 Revamp entropy configuraiton
- Move both settings to its dedicated model entropy configuration
- A collection can have an entropy configuration, or will default to the account if not
2025-06-04 10:41:08 +02:00

19 lines
539 B
Ruby

module Account::Entropy
extend ActiveSupport::Concern
included do
has_one :default_entropy_configuration, class_name: "Entropy::Configuration", as: :container, dependent: :destroy
before_save :set_default_entropy_configuration
end
private
DEFAULT_ENTROPY_PERIOD = 30.days
def set_default_entropy_configuration
self.default_entropy_configuration ||= build_default_entropy_configuration \
auto_close_period: DEFAULT_ENTROPY_PERIOD,
auto_reconsider_period: DEFAULT_ENTROPY_PERIOD
end
end