]> git.openstreetmap.org Git - rails.git/commitdiff
Fix new rubocop warnings
authorTom Hughes <tom@compton.nu>
Tue, 31 Mar 2020 18:08:10 +0000 (19:08 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 31 Mar 2020 18:08:10 +0000 (19:08 +0100)
app/controllers/api/user_preferences_controller.rb

index 83e28bc4e0047ef4e3a9a880a08406813f654693..ddc5d7f430a9eff0c085bedaf40cf3a9d70a76b5 100644 (file)
@@ -25,9 +25,7 @@ module Api
 
     # update the entire set of preferences
     def update_all
-      old_preferences = current_user.preferences.each_with_object({}) do |preference, preferences|
-        preferences[preference.k] = preference
-      end
+      old_preferences = current_user.preferences.index_by(&:k)
 
       new_preferences = {}