X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b4c0bfd8fa324a4c9d8b24e8753d134524ea61c7..dd1f94e3414d1cbea71706dcb0e3a418db208efd:/app/models/trace.rb?ds=inline diff --git a/app/models/trace.rb b/app/models/trace.rb index a7e19bef8..7c4b5de18 100644 --- a/app/models/trace.rb +++ b/app/models/trace.rb @@ -1,4 +1,14 @@ class Trace < ActiveRecord::Base set_table_name 'gpx_files' - has_many :trace_points, :foreign_key => 'gpx_id' + + belongs_to :user + has_many :tags, :class_name => 'Tracetag', :foreign_key => 'gpx_id', :dependent => :destroy + + def tagstring=(s) + self.tags = s.split().collect {|tag| + tt = Tracetag.new + tt.tag = tag + tt + } + end end