class IWebsite < ActiveRecord::Base
  belongs_to :p_customer
  belongs_to :admin
  
  has_many :i_tasks
  
  def show_name
    self.name.to_s+(" - "+self.url.to_s if self.url?).to_s+(" - "+self.prov_url.to_s if self.prov_url?).to_s
  end

  before_save do
    self.verify 
  end
	def verify(size=16)
		if !self.token
			s = ""
			size.times { s << (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }
			self.token = s
    end
  end


end
