]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/old_node.rb
Cleanup trailing whitespace
[rails.git] / app / models / old_node.rb
index 3a0ecc367a5b98f7862bdc7fb91039102db6d431..b3ed96cd09f850e441add79e2c8f5e2ac6d8b8fd 100644 (file)
@@ -38,7 +38,7 @@ class OldNode < ActiveRecord::Base
     old_node.version = node.version
     return old_node
   end
-  
+
   def to_xml
     doc = OSM::API.new.get_xml_doc
     doc.root << to_xml_node()
@@ -63,12 +63,7 @@ class OldNode < ActiveRecord::Base
 
   def save_with_dependencies!
     save!
-    #not sure whats going on here
-    clear_aggregation_cache
-    clear_association_cache
-    #ok from here
-    @attributes.update(OldNode.where(:node_id => self.node_id, :timestamp => self.timestamp, :version => self.version).first.instance_variable_get('@attributes'))
-   
+
     self.tags.each do |k,v|
       tag = OldNodeTag.new
       tag.k = k
@@ -80,33 +75,26 @@ class OldNode < ActiveRecord::Base
   end
 
   def tags
-    unless @tags
-      @tags = Hash.new
-      self.old_tags.each do |tag|
-        @tags[tag.k] = tag.v
-      end
-    end
-    @tags = Hash.new unless @tags
-    @tags
+    @tags ||= Hash[self.old_tags.collect { |t| [t.k, t.v] }]
   end
 
   def tags=(t)
-    @tags = t 
+    @tags = t
   end
 
-  def tags_as_hash 
+  def tags_as_hash
     return self.tags
-  end 
-  # Pretend we're not in any ways 
-  def ways 
-    return [] 
-  end 
-  # Pretend we're not in any relations 
-  def containing_relation_members 
-    return [] 
-  end 
+  end
+
+  # Pretend we're not in any ways
+  def ways
+    return []
+  end
+
+  # Pretend we're not in any relations
+  def containing_relation_members
+    return []
+  end
 
   # check whether this element is the latest version - that is,
   # has the same version as its "current" counterpart.