From 54d4e5252be8cd9fa780df46e06541da8263d368 Mon Sep 17 00:00:00 2001 From: ThibG Date: Tue, 12 Jan 2021 09:27:38 +0100 Subject: Use Rails' index_by where it makes sense (#15542) * Use Rails' index_by where it makes sense * Fix tests Co-authored-by: Claire --- app/lib/settings/scoped_settings.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/lib/settings') diff --git a/app/lib/settings/scoped_settings.rb b/app/lib/settings/scoped_settings.rb index ef694205c..acabf0c8e 100644 --- a/app/lib/settings/scoped_settings.rb +++ b/app/lib/settings/scoped_settings.rb @@ -30,7 +30,7 @@ module Settings def all_as_records vars = thing_scoped - records = vars.each_with_object({}) { |r, h| h[r.var] = r } + records = vars.index_by(&:var) Setting.default_settings.each do |key, default_value| next if records.key?(key) || default_value.is_a?(Hash) -- cgit