Change user settings to be stored in a more optimal way (#23630)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
e7c3e55874
commit
a9b5598c97
36 changed files with 817 additions and 525 deletions
19
app/lib/user_settings_serializer.rb
Normal file
19
app/lib/user_settings_serializer.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class UserSettingsSerializer
|
||||
def self.load(value)
|
||||
json = begin
|
||||
if value.blank?
|
||||
{}
|
||||
else
|
||||
Oj.load(value, symbol_keys: true)
|
||||
end
|
||||
end
|
||||
|
||||
UserSettings.new(json)
|
||||
end
|
||||
|
||||
def self.dump(value)
|
||||
Oj.dump(value.as_json)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue