Class: ClientRepresentative

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
HasCredentialModelHelper
Defined in:
app/models/client_representative.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HasCredentialModelHelper

append_features, #credential_after_save, #validate_credential_fields

Class Method Details

.find(*args) ⇒ Object

This fixes (I guess its a bug?) in _add_existing_form.html when ClientReps are being shown as a sublist in Clients, and the user chooses to “Add Existing”. Without this - the order Is totally effed.



25
26
27
# File 'app/models/client_representative.rb', line 25

def self.find(*args)
  (args == [:all]) ? super(:all, :order => 'first_name ASC, last_name ASC') : super(*args)
end

Instance Method Details

#nameObject



12
13
14
15
16
17
18
19
20
# File 'app/models/client_representative.rb', line 12

def name
  ret = String.new
  
  ret += self.first_name if !self.first_name.nil? and self.first_name.length > 0
  
  ret += (ret.length > 0) ? " #{self.last_name}" : self.last_name if !self.last_name.nil? and self.last_name.length > 0
  
  ret
end