More tag validations, and finishing the node/way/relation tests.

This commit is contained in:
Shaun McDonald 2008-11-19 17:23:15 +00:00
parent 55d511bf21
commit ffbc4d5cb2
7 changed files with 40 additions and 7 deletions

View file

@ -5,4 +5,6 @@ class NodeTag < ActiveRecord::Base
validates_presence_of :id
validates_length_of :k, :v, :maximum => 255, :allow_blank => true
validates_uniqueness_of :id, :scope => :k
validates_numericality_of :id, :only_integer => true
end

View file

@ -1,9 +1,10 @@
class OldNodeTag < ActiveRecord::Base
belongs_to :user
set_table_name 'node_tags'
belongs_to :user
validates_presence_of :id, :version
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

View file

@ -1,3 +1,10 @@
class OldRelationTag < ActiveRecord::Base
set_table_name 'relation_tags'
belongs_to :old_relation, :foreign_key => [:id, :version]
validates_presence_of :id, :version
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

View file

@ -1,8 +1,8 @@
class OldWayTag < ActiveRecord::Base
belongs_to :old_way
set_table_name 'way_tags'
belongs_to :old_way, :foreign_key => [:id, :version]
validates_presence_of :id
validates_length_of :k, :v, :maximum => 255, :allow_blank => true
validates_uniqueness_of :id, :scope => [:k, :version]