X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/4377e2bd55bd6bed320b7c3595087d4317b1c9bc..50b2f4f656b82112fce4939da26a1afc6b140e89:/app/models/relation.rb diff --git a/app/models/relation.rb b/app/models/relation.rb index bcac9d04b..3f812d1b1 100644 --- a/app/models/relation.rb +++ b/app/models/relation.rb @@ -17,7 +17,7 @@ # current_relations_changeset_id_fkey (changeset_id => changesets.id) # -class Relation < ActiveRecord::Base +class Relation < ApplicationRecord require "xml/libxml" include ConsistencyValidations @@ -37,11 +37,11 @@ class Relation < ActiveRecord::Base has_many :containing_relations, :class_name => "Relation", :through => :containing_relation_members, :source => :relation validates :id, :uniqueness => true, :presence => { :on => :update }, - :numericality => { :on => :update, :integer_only => true } + :numericality => { :on => :update, :only_integer => true } validates :version, :presence => true, - :numericality => { :integer_only => true } + :numericality => { :only_integer => true } validates :changeset_id, :presence => true, - :numericality => { :integer_only => true } + :numericality => { :only_integer => true } validates :timestamp, :presence => true validates :changeset, :associated => true validates :visible, :inclusion => [true, false] @@ -121,31 +121,6 @@ class Relation < ActiveRecord::Base relation end - def to_xml - doc = OSM::API.new.get_xml_doc - doc.root << to_xml_node - doc - end - - def to_xml_node(changeset_cache = {}, user_display_name_cache = {}) - el = XML::Node.new "relation" - el["id"] = id.to_s - - add_metadata_to_xml_node(el, self, changeset_cache, user_display_name_cache) - - relation_members.each do |member| - member_el = XML::Node.new "member" - member_el["type"] = member.member_type.downcase - member_el["ref"] = member.member_id.to_s - member_el["role"] = member.member_role - el << member_el - end - - add_tags_to_xml_node(el, relation_tags) - - el - end - # FIXME: is this really needed? def members @members ||= relation_members.map do |member|