# encoding: utf-8
class KontaktneOsoby < ActiveRecord::Base
  set_primary_key :ID_Kontakt
  set_table_name :kontaktne_osoby
  
  belongs_to :firmy, :foreign_key => 'ID_Firma', :class_name => Firmy
  
  validates :Meno, :Priezvisko, :Telefon, :Email, :ID_Firma, :presence => true
  
  validates_length_of :Meno, :maximum => 15
  validates_length_of :Priezvisko, :maximum => 25
  validates_length_of :Titul, :maximum => 20
  validates_length_of :Telefon, :in => 13..14, :too_short => 'Prosím vložte aj s predvoľbou +421/+420/...'
  validates_length_of :Email, :Poznamka, :maximum => 50
end
