]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/trace.rb
add tags to gpx files
[rails.git] / app / models / trace.rb
index 451067b21fe53255507ebcc1093b7afb74019a39..06e3dc1a12acd20974dba790080a535bffbef2df 100644 (file)
@@ -2,8 +2,13 @@ class Trace < ActiveRecord::Base
   set_table_name 'gpx_files'
 
   belongs_to :user
+  has_many :tags, :class_name => 'Tracetag', :foreign_key => 'gpx_id'
 
-  def tags=(bleh)
-
+  def tagstring=(s)
+    self.tags = s.split().collect {|tag|
+      tt = Tracetag.new
+      tt.tag = tag
+      tt
+    }
   end
 end