Make negative caching of users work.
authorTom Hughes <tom@compton.nu>
Wed, 27 Jun 2007 18:16:04 +0000 (18:16 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 27 Jun 2007 18:16:04 +0000 (18:16 +0000)
app/models/node.rb
app/models/segment.rb
app/models/way.rb

index 8b09ffef77d8cd3f4131da9faab05be65c1ac750..230c83882cf12fee4ba8d23e5477cdc0e40729bc 100644 (file)
@@ -97,7 +97,7 @@ class Node < ActiveRecord::Base
 
     user_display_name_cache = {} if user_display_name_cache.nil?
 
-    if user_display_name_cache and user_display_name_cache[self.user_id]
+    if user_display_name_cache and user_display_name_cache.key?(self.user_id)
       # use the cache if available
     elsif self.user.data_public?
       user_display_name_cache[self.user_id] = self.user.display_name
index aa4e07887cca2751301954848029dd9be60ead18..bdb807d9399991cb7faa9ec70898ecccff767345 100644 (file)
@@ -88,7 +88,7 @@ class Segment < ActiveRecord::Base
 
     user_display_name_cache = {} if user_display_name_cache.nil?
 
-    if user_display_name_cache and user_display_name_cache[self.user_id]
+    if user_display_name_cache and user_display_name_cache.key?(self.user_id)
       # use the cache if available
     elsif self.user.data_public?
       user_display_name_cache[self.user_id] = self.user.display_name
index fe16e98c3257f86cbaa795cd8d3765ed4fd6f3ae..c6316d330809992df17afad252f77922445ab4b3 100644 (file)
@@ -61,7 +61,7 @@ class Way < ActiveRecord::Base
 
     user_display_name_cache = {} if user_display_name_cache.nil?
     
-    if user_display_name_cache and user_display_name_cache[self.user_id]
+    if user_display_name_cache and user_display_name_cache.key?(self.user_id)
       # use the cache if available
     elsif self.user.data_public?
       user_display_name_cache[self.user_id] = self.user.display_name