belongs_to :user
- has_many :changeset_tags, :foreign_key => 'id'
+ has_many :changeset_tags
has_many :nodes
has_many :ways
def self.from_xml(xml, create=false)
begin
- p = XML::Parser.string(xml)
+ p = XML::Parser.string(xml, :options => XML::Parser::Options::NOERROR)
doc = p.parse
doc.find('//osm/changeset').each do |pt|
self.save!
tags = self.tags
- ChangesetTag.delete_all(['id = ?', self.id])
+ ChangesetTag.delete_all(:changeset_id => self.id)
tags.each do |k,v|
tag = ChangesetTag.new
+ tag.changeset_id = self.id
tag.k = k
tag.v = v
- tag.id = self.id
tag.save!
end
end