Sha256: c5676b71def6dde047104215e7cbc61daace7eb8e5725efe8d9f52a3dabd6827

Contents?: true

Size: 588 Bytes

Versions: 2

Compression:

Stored size: 588 Bytes

Contents

class ClientRepresentative < ActiveRecord::Base
  include HasCredentialModelHelper

  has_and_belongs_to_many :clients, :join_table => 'client_representatives_clients', :uniq => true
  
  validates_presence_of(
    :first_name,
    :unless => Proc.new { |cr| !cr.last_name.nil? and cr.last_name.length > 0 }, 
    :message => " or Last name must be not be blank"
  )
  
  def name
    [
      first_name, last_name
    ].find_all{|x| x.try(:length).try(:>,0)}.join(' ')
  end

  # This is used by the Nested Add_existing control label
  def self.human_name
    'Representative'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
brisk-bills-0.8.2 app/models/client_representative.rb
brisk-bills-0.8.1 app/models/client_representative.rb