Class: LocatorWhiteListParty
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- LocatorWhiteListParty
- Includes:
- Models::Auditable
- Defined in:
- app/models/locator_white_list_party.rb
Overview
== Schema Information
Table name: locator_white_list_parties
Database name: primary
id :integer not null, primary key
inform_customer :boolean
reason :string(255)
created_at :datetime
updated_at :datetime
creator_id :integer
customer_id :integer
Indexes
index_locator_white_list_parties_on_customer_id (customer_id)
Constant Summary
Constants included from Models::Auditable
Models::Auditable::ALWAYS_IGNORED
Constants included from Models::Schedulable
Models::Schedulable::SIMPLE_FORM_OPTIONS
Instance Attribute Summary collapse
-
#customer_id ⇒ Integer
Foreign key to the whitelisted customer.
Belongs to collapse
Methods included from Models::Auditable
Instance Method Summary collapse
- #not_a_homeowner ⇒ nil protected
- #not_blacklisted ⇒ nil protected
- #whitelist_locator_record_if_any ⇒ LocatorRecord
Methods included from Models::Auditable
#all_skipped_columns, #audit_reference_data, #should_not_save_version, #stamp_record
Methods inherited from ApplicationRecord
ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation
Methods included from Models::Schedulable
Methods included from Models::AfterCommittable
Methods included from Models::EventPublishable
Instance Attribute Details
#customer_id ⇒ Integer
Returns Foreign key to the whitelisted customer.
Validations:
27 |
# File 'app/models/locator_white_list_party.rb', line 27 validates :customer_id, presence: true |
Instance Method Details
#customer ⇒ Customer
23 |
# File 'app/models/locator_white_list_party.rb', line 23 belongs_to :customer, optional: true, inverse_of: :locator_white_listing |
#not_a_homeowner ⇒ nil (protected)
52 53 54 |
# File 'app/models/locator_white_list_party.rb', line 52 def not_a_homeowner errors.add("Customer is a homeowner", "cannot be white listed") if customer.is_homeowner? end |
#not_blacklisted ⇒ nil (protected)
47 48 49 |
# File 'app/models/locator_white_list_party.rb', line 47 def not_blacklisted errors.add("Customer is already black listed", "cannot be white listed") if customer.locator_black_listing end |
#whitelist_locator_record_if_any ⇒ LocatorRecord
33 34 35 36 37 38 39 40 41 42 |
# File 'app/models/locator_white_list_party.rb', line 33 def whitelist_locator_record_if_any if customer.locator_record customer.locator_record.whitelist else CustomerLocatorUtility.create_default_locator_record customer end # if inform_customer # self.customer.locator_record.send_whitelist_notice # end end |