mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-28 19:24:10 +08:00
Fix update of database settings values [SCI-9240]
This commit is contained in:
parent
cc1d179366
commit
18072bbde7
1 changed files with 6 additions and 2 deletions
|
@ -1,14 +1,18 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Settings < ApplicationRecord
|
||||
attr_accessor :merged_values
|
||||
|
||||
before_validation -> { self.values = merged_values || values }
|
||||
|
||||
def self.instance
|
||||
first || new
|
||||
end
|
||||
|
||||
def values
|
||||
merged_values = super
|
||||
self.merged_values ||= super
|
||||
self.class.instance_methods(false).grep(/^load_values_from_[A-Z0-9_]*/).each do |method|
|
||||
merged_values = merged_values.merge(public_send(method))
|
||||
self.merged_values = self.merged_values.merge(public_send(method))
|
||||
end
|
||||
merged_values
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue