X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/92feab9112e64b8aab280cb90d5a5fef75646e3b..59d5b5fa6eb09e159771d170f0831ec49283c91a:/app/models/way.rb?ds=inline 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)