]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/changeset_tag.rb
Check the oauth token and then use the capabilities directly
[rails.git] / app / models / changeset_tag.rb
index 6298fbe778e8da9870c41f3f82976ff24287a6c0..8d6cd45ac3bb1056aa72f8643b4dfd7c8c37ffe1 100644 (file)
@@ -1,5 +1,26 @@
+# == Schema Information
+#
+# Table name: changeset_tags
+#
+#  changeset_id :integer          not null, primary key
+#  k            :string           default(""), not null, primary key
+#  v            :string           default(""), not null
+#
+# Indexes
+#
+#  changeset_tags_id_idx  (changeset_id)
+#
+# Foreign Keys
+#
+#  changeset_tags_id_fkey  (changeset_id => changesets.id)
+#
+
 class ChangesetTag < ActiveRecord::Base
 class ChangesetTag < ActiveRecord::Base
+  self.primary_keys = "changeset_id", "k"
 
 
-  belongs_to :changeset, :foreign_key => 'id'
+  belongs_to :changeset
 
 
+  validates :changeset, :presence => true, :associated => true
+  validates :k, :v, :allow_blank => true, :length => { :maximum => 255 }
+  validates :k, :uniqueness => { :scope => :changeset_id }
 end
 end