]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/old_way_tag.rb
Validations on the way tags, with unit tests
[rails.git] / app / models / old_way_tag.rb
index b02fd45b93ad8f23ba3aea7271bcef1ddfce5051..547fd177cabc263ab99994ec526ef5c84090544a 100644 (file)
@@ -3,4 +3,8 @@ class OldWayTag < ActiveRecord::Base
 
   set_table_name 'way_tags'
 
+  validates_presence_of :id
+  validates_length_of :k, :v, :maximum => 255, :allow_blank => true
+  validates_uniqueness_of :id, :scope => [:k, :version]
+  validates_numericality_of :id, :version, :only_integer => true
 end