Class: Adviser
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Adviser
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, #coordinates=, #geocode, #geocoded?, included, #latitude=, #longitude=, #needs_to_be_geocoded?, #save_with_geocoding, #update_with_geocoding
Instance Attribute Details
#old_firm_id ⇒ Object
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
49
50
51
52
53
54
55
|
# File 'app/models/adviser.rb', line 49
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
44
45
46
47
|
# File 'app/models/adviser.rb', line 44
def self.on_firms_with_fca_number(fca_number)
firms = Firm.where(fca_number: fca_number)
where(firm: firms)
end
|
Instance Method Details
#add_geocoding_failed_error ⇒ Object
65
66
67
|
# File 'app/models/adviser.rb', line 65
def add_geocoding_failed_error
errors.add(:geocoding, I18n.t("#{model_name.i18n_key}.geocoding.failure_message"))
end
|
#field_order ⇒ Object
69
70
71
72
73
74
75
|
# File 'app/models/adviser.rb', line 69
def field_order
[
:reference_number,
:postcode,
:travel_distance
]
end
|
#full_street_address ⇒ Object
57
58
59
|
# File 'app/models/adviser.rb', line 57
def full_street_address
"#{postcode}, United Kingdom"
end
|
#has_address_changes? ⇒ Boolean
61
62
63
|
# File 'app/models/adviser.rb', line 61
def has_address_changes?
changed_attributes.include? :postcode
end
|