From 0da022a1ba7283517fc2999ad483eaf433b93324 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 9 Feb 2015 17:28:55 -0500 Subject: [PATCH] FIX: Make sure to observe shadowed settings when refreshing --- lib/site_setting_extension.rb | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/site_setting_extension.rb b/lib/site_setting_extension.rb index e1a68baf3..d700a5287 100644 --- a/lib/site_setting_extension.rb +++ b/lib/site_setting_extension.rb @@ -196,18 +196,20 @@ module SiteSettingExtension # add defaults, cause they are cached new_hash = defaults.merge(new_hash) - changes,deletions = diff_hash(new_hash, old) - - if deletions.length > 0 || changes.length > 0 - changes.each do |name, val| - next if shadowed_settings.include?(name) - current[name] = val - end - deletions.each do |name,val| - next if shadowed_settings.include?(name) - current[name] = defaults[name] - end + # add shadowed + shadowed_settings.each do |ss| + new_hash[ss] = GlobalSetting.send(ss) end + + changes, deletions = diff_hash(new_hash, old) + + changes.each do |name, val| + current[name] = val + end + deletions.each do |name, val| + current[name] = defaults[name] + end + clear_cache! end end