Files
fizzy/app/models/account/entropic.rb
T
Jorge Manrubia db86d17880 Refactor to introduce an entropy model
Instead of keeping two tracks of similar logic (auto-reconsider / auto-close).
2025-06-04 14:40:02 +02:00

19 lines
540 B
Ruby

module Account::Entropic
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