discourse/lib/theme_settings_manager/objects.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
413 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class ThemeSettingsManager::Objects < ThemeSettingsManager
def value
has_record? ? db_record.json_value : default.map!(&:deep_stringify_keys)
end
def value=(objects)
# TODO: Validate the objects against the schema
record = has_record? ? db_record : create_record!
record.json_value = objects
record.save!
theme.reload
record.json_value
end
end