# encoding: utf-8
class EvidenciaZmluv < ActiveRecord::Base
  set_primary_key :ID_Zmluva
  set_table_name :evidencia_zmluv
  
  belongs_to :zamestnanci, :foreign_key => 'ID_Zam', :class_name => Zamestnanci
  belongs_to :klienti, :foreign_key => 'ID_Klient', :class_name => Klienti
  belongs_to :firmy, :foreign_key => 'ID_Firma', :class_name => Firmy
  
  validates :Datum_Od, :Datum_Do, :presence => true
  validates :Nazov_Suboru, :format => {
      :with => %r{\.(pdf/xml/html)$}i,
      :message => 'Je mozne vlozit adresu URL pre obrazky typu .pdf/.xml/.html'
    }
  validates_length_of :Nazov_Suboru, :maximum => 40
  validates_length_of :Umiestnenie, :maximum => 10
end
