91787a3523
- Move both settings to its dedicated model entropy configuration - A collection can have an entropy configuration, or will default to the account if not
19 lines
539 B
Ruby
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
|