1 class Changeset < ActiveRecord::Base
6 has_many :changeset_tags, :foreign_key => 'id'
8 def self.from_xml(xml, create=false)
16 doc.find('//osm/changeset').each do |pt|
18 cs.created_at = Time.now
21 pt.find('tag').each do |tag|
22 cs.add_tag_keyval(tag['k'], tag['v'])
25 rescue Exception => ex
26 print "noes "+ ex.to_s + "\n"
36 self.changeset_tags.each do |tag|
47 def add_tag_keyval(k, v)
48 @tags = Hash.new unless @tags
55 Changeset.transaction do
56 # fixme update modified_at time?
60 ChangesetTag.transaction do
62 ChangesetTag.delete_all(['id = ?', self.id])
65 tag = ChangesetTag.new