]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/api/user_preferences_controller.rb
Refactor user controller tests
[rails.git] / 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
 
     # 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 = {}
 
 
       new_preferences = {}