Class: Firm
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Firm
- Includes:
- Geocodable
- Defined in:
- app/models/firm.rb
Constant Summary collapse
- ADVICE_TYPES_ATTRIBUTES =
[ :retirement_income_products_flag, :pension_transfer_flag, :long_term_care_flag, :equity_release_flag, :inheritance_tax_and_estate_planning_flag, :wills_and_probate_flag ]
Instance Attribute Summary collapse
-
#percent_total ⇒ Object
Returns the value of attribute percent_total.
-
#primary_advice_method ⇒ Object
Returns the value of attribute primary_advice_method.
Instance Method Summary collapse
- #advice_types ⇒ Object
- #field_order ⇒ Object
- #full_street_address ⇒ Object
- #geocode ⇒ Object
- #in_person_advice? ⇒ Boolean (also: #postcode_searchable?)
- #main_office ⇒ Object
- #registered? ⇒ Boolean
- #telephone_number ⇒ Object
- #trading_name? ⇒ Boolean (also: #subsidiary?)
Methods included from Geocodable
#coordinates, #geocode!, #geocoded?, included, #latitude=, #longitude=
Instance Attribute Details
#percent_total ⇒ Object
Returns the value of attribute percent_total.
34 35 36 |
# File 'app/models/firm.rb', line 34 def percent_total @percent_total end |
#primary_advice_method ⇒ Object
Returns the value of attribute primary_advice_method.
35 36 37 |
# File 'app/models/firm.rb', line 35 def primary_advice_method @primary_advice_method end |
Instance Method Details
#advice_types ⇒ Object
185 186 187 |
# File 'app/models/firm.rb', line 185 def advice_types ADVICE_TYPES_ATTRIBUTES.map { |a| [a, self[a]] }.to_h end |
#field_order ⇒ Object
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'app/models/firm.rb', line 154 def field_order [ :email_address, :telephone_number, :address_line_one, :address_line_two, :address_town, :address_county, :address_postcode, :in_person_advice_methods, :other_advice_methods, :free_initial_meeting, :initial_meeting_duration, :initial_advice_fee_structures, :ongoing_advice_fee_structures, :allowed_payment_methods, :minimum_fixed_fee, :percent_total, *ADVICE_TYPES_ATTRIBUTES, :ethical_investing_flag, :sharia_investing_flag, :languages, :investment_sizes ] end |
#full_street_address ⇒ Object
139 140 141 |
# File 'app/models/firm.rb', line 139 def full_street_address [address_line_one, address_line_two, address_postcode, 'United Kingdom'].delete_if(&:blank?).join(', ') end |
#geocode ⇒ Object
180 181 182 183 |
# File 'app/models/firm.rb', line 180 def geocode return if destroyed? GeocodeFirmJob.perform_later(self) end |
#in_person_advice? ⇒ Boolean Also known as: postcode_searchable?
143 144 145 |
# File 'app/models/firm.rb', line 143 def in_person_advice? in_person_advice_methods.present? end |
#main_office ⇒ Object
194 195 196 |
# File 'app/models/firm.rb', line 194 def main_office offices.first end |
#registered? ⇒ Boolean
127 128 129 |
# File 'app/models/firm.rb', line 127 def registered? email_address.present? end |
#telephone_number ⇒ Object
133 134 135 136 137 |
# File 'app/models/firm.rb', line 133 def telephone_number return nil unless self[:telephone_number] self[:telephone_number].gsub(' ', '') end |
#trading_name? ⇒ Boolean Also known as: subsidiary?
148 149 150 |
# File 'app/models/firm.rb', line 148 def trading_name? parent.present? end |