+ new_preferences[preference.k] = preference
+ end
+
+ old_preferences.each_value(&:delete)
+
+ new_preferences.each_value(&:save!)
+
+ render :plain => ""
+ end
+
+ ##
+ # update the value of a single preference
+ def update_one
+ begin
+ pref = UserPreference.find([current_user.id, params[:preference_key]])
+ rescue ActiveRecord::RecordNotFound
+ pref = UserPreference.new
+ pref.user = current_user
+ pref.k = params[:preference_key]