]> git.openstreetmap.org Git - rails.git/blob - app/models/old_node_tag.rb
Merge remote-tracking branch 'upstream/pull/2167'
[rails.git] / app / models / old_node_tag.rb
1 # == Schema Information
2 #
3 # Table name: node_tags
4 #
5 #  node_id :integer          not null, primary key
6 #  version :integer          not null, primary key
7 #  k       :string           default(""), not null, primary key
8 #  v       :string           default(""), not null
9 #
10 # Foreign Keys
11 #
12 #  node_tags_id_fkey  (node_id => nodes.node_id)
13 #
14
15 class OldNodeTag < ActiveRecord::Base
16   self.table_name = "node_tags"
17   self.primary_keys = "node_id", "version", "k"
18
19   belongs_to :old_node, :foreign_key => [:node_id, :version]
20
21   validates :old_node, :presence => true, :associated => true
22   validates :k, :v, :allow_blank => true, :length => { :maximum => 255 }, :characters => true
23   validates :k, :uniqueness => { :scope => [:node_id, :version] }
24 end