changing the belongs_to and has_many items in the models to reflect the new foriegn keys in the db and the fact that a (old)node/way/relation now belong to a changeset, which in turn has a user.
This commit is contained in:
parent
d19076d0ed
commit
40414cf324
7 changed files with 13 additions and 6 deletions
|
@ -5,6 +5,13 @@ class Changeset < ActiveRecord::Base
|
|||
|
||||
has_many :changeset_tags, :foreign_key => 'id'
|
||||
|
||||
has_many :nodes
|
||||
has_many :ways
|
||||
has_many :relations
|
||||
has_many :old_nodes
|
||||
has_many :old_ways
|
||||
has_many :old_relations
|
||||
|
||||
def self.from_xml(xml, create=false)
|
||||
begin
|
||||
p = XML::Parser.new
|
||||
|
|
|
@ -10,7 +10,7 @@ class Node < ActiveRecord::Base
|
|||
validates_numericality_of :latitude, :longitude
|
||||
validate :validate_position
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :changeset
|
||||
|
||||
has_many :old_nodes, :foreign_key => :id
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ class OldNode < ActiveRecord::Base
|
|||
validates_numericality_of :latitude, :longitude
|
||||
validate :validate_position
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :changeset
|
||||
|
||||
def validate_position
|
||||
errors.add_to_base("Node is not in the world") unless in_world?
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class OldRelation < ActiveRecord::Base
|
||||
set_table_name 'relations'
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :changeset
|
||||
|
||||
def self.from_relation(relation)
|
||||
old_relation = OldRelation.new
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class OldWay < ActiveRecord::Base
|
||||
set_table_name 'ways'
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :changeset
|
||||
|
||||
def self.from_way(way)
|
||||
old_way = OldWay.new
|
||||
|
|
|
@ -3,7 +3,7 @@ class Relation < ActiveRecord::Base
|
|||
|
||||
set_table_name 'current_relations'
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :changeset
|
||||
|
||||
has_many :old_relations, :foreign_key => 'id', :order => 'version'
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ class Way < ActiveRecord::Base
|
|||
|
||||
set_table_name 'current_ways'
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :changeset
|
||||
|
||||
has_many :old_ways, :foreign_key => 'id', :order => 'version'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue