X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/a9ff3bfc4b94530debc35bee33ee7558d0f7b61d..226c41be692452129227f30d67f2d847e510015c:/app/models/node.rb diff --git a/app/models/node.rb b/app/models/node.rb index 3a1d580e0..3de6e154c 100644 --- a/app/models/node.rb +++ b/app/models/node.rb @@ -8,7 +8,7 @@ class Node < ActiveRecord::Base belongs_to :changeset - has_many :old_nodes, :foreign_key => :id + has_many :old_nodes, :foreign_key => :id, :order => :version has_many :way_nodes has_many :ways, :through => :way_nodes @@ -30,6 +30,9 @@ class Node < ActiveRecord::Base validate :validate_position validates_associated :changeset + scope :visible, where(:visible => true) + scope :invisible, where(:visible => false) + # Sanity check the latitude and longitude and add an error if it's broken def validate_position errors.add_to_base("Node is not in the world") unless in_world?