]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/node.rb
Add inverse_of to relationships that can't detect it automatically
[rails.git] / app / models / node.rb
index a5346e87f39b71f297b9b6b4948d01f271d2618e..f6f0f258e4d3e9ef7eb10324cdd72858b7e3c4cd 100644 (file)
@@ -27,13 +27,12 @@ class Node < ApplicationRecord
   include GeoRecord
   include ConsistencyValidations
   include NotRedactable
-  include ObjectMetadata
 
   self.table_name = "current_nodes"
 
   belongs_to :changeset
 
-  has_many :old_nodes, -> { order(:version) }
+  has_many :old_nodes, -> { order(:version) }, :inverse_of => :current_node
 
   has_many :way_nodes
   has_many :ways, :through => :way_nodes
@@ -207,7 +206,7 @@ class Node < ApplicationRecord
   end
 
   def tags
-    @tags ||= Hash[node_tags.collect { |t| [t.k, t.v] }]
+    @tags ||= node_tags.to_h { |t| [t.k, t.v] }
   end
 
   attr_writer :tags