Class: Adviser

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Geocodable

#coordinates, #geocode!, #geocoded?, included, #latitude=, #longitude=

Instance Attribute Details

#old_firm_idObject (readonly)

Returns the value of attribute old_firm_id.



4
5
6
# File 'app/models/adviser.rb', line 4

def old_firm_id
  @old_firm_id
end

Class Method Details

.move_all_to_firm(receiving_firm) ⇒ Object



45
46
47
48
49
50
51
# File 'app/models/adviser.rb', line 45

def self.move_all_to_firm(receiving_firm)
  transaction do
    current_scope.each do |adviser|
      adviser.update!(firm: receiving_firm)
    end
  end
end

.on_firms_with_fca_number(fca_number) ⇒ Object



40
41
42
43
# File 'app/models/adviser.rb', line 40

def self.on_firms_with_fca_number(fca_number)
  firms = Firm.where(fca_number: fca_number)
  where(firm: firms)
end

Instance Method Details

#field_orderObject



57
58
59
60
61
62
63
# File 'app/models/adviser.rb', line 57

def field_order
  [
    :reference_number,
    :postcode,
    :travel_distance
  ]
end

#full_street_addressObject



53
54
55
# File 'app/models/adviser.rb', line 53

def full_street_address
  "#{postcode}, United Kingdom"
end