class PCustomerRib < ActiveRecord::Base
  belongs_to :p_customer
  
  has_many :p_documents, :dependent => :nullify
  
  def generate_rum
    if self.sign_date
     
      self.rum = "JOA"+self.p_customer.ref.to_s+self.sign_date.year.to_s+('%02d' % self.sign_date.month)+('%02d' % self.sign_date.day)
      self.save
    end
  end
end