]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/old_way_tag.rb
Simplify a number of object model methods
[rails.git] / app / models / old_way_tag.rb
index 801532dbaa7632d2074e33fbb48ac4a5251285a3..9926db1446310fdf46d41aa6592df8f203a59331 100644 (file)
@@ -1,10 +1,11 @@
 class OldWayTag < ActiveRecord::Base
-  set_table_name 'way_tags'
+  self.table_name = "way_tags"
+  self.primary_keys = "way_id", "version", "k"
 
-  belongs_to :old_way, :foreign_key => [:id, :version]
+  belongs_to :old_way, :foreign_key => [:way_id, :version]
 
-  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
+  validates_presence_of :old_way
+  validates_length_of :k, :maximum => 255, :allow_blank => true
+  validates_uniqueness_of :k, :scope => [:way_id, :version]
+  validates_length_of :v, :maximum => 255, :allow_blank => true
 end