X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e660e609661edadc1ed5ad49d6e83e936b2f91cd..dc931c4ac47b340c9a2a8d855fa57a290e838260:/app/models/way.rb?ds=sidebyside diff --git a/app/models/way.rb b/app/models/way.rb index adf8b928f..58a9214fa 100644 --- a/app/models/way.rb +++ b/app/models/way.rb @@ -2,15 +2,16 @@ class Way < ActiveRecord::Base require 'xml/libxml' include ConsistencyValidations + include NotRedactable self.table_name = "current_ways" belongs_to :changeset - has_many :old_ways, :order => 'version' + has_many :old_ways, -> { order(:version) } - has_many :way_nodes, :order => 'sequence_id' - has_many :nodes, :through => :way_nodes, :order => 'sequence_id' + has_many :way_nodes, -> { order(:sequence_id) } + has_many :nodes, -> { order("sequence_id") }, :through => :way_nodes has_many :way_tags @@ -25,8 +26,8 @@ class Way < ActiveRecord::Base validates_numericality_of :id, :on => :update, :integer_only => true validates_associated :changeset - scope :visible, where(:visible => true) - scope :invisible, where(:visible => false) + scope :visible, -> { where(:visible => true) } + scope :invisible, -> { where(:visible => false) } # Read in xml as text and return it's Way object representation def self.from_xml(xml, create=false)