Class: LocatorBlackListParty
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- LocatorBlackListParty
- Includes:
- Models::Auditable
- Defined in:
- app/models/locator_black_list_party.rb
Overview
== Schema Information
Table name: locator_black_list_parties
Database name: primary
id :integer not null, primary key
inform_customer :boolean
reason :text
created_at :datetime
updated_at :datetime
creator_id :integer
customer_id :integer
Indexes
index_locator_black_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 blacklisted customer.
Belongs to collapse
Methods included from Models::Auditable
Instance Method Summary collapse
- #blacklist_locator_record_if_any ⇒ void
- #not_a_homeowner ⇒ nil protected
- #not_already_whitelisted ⇒ nil protected
- #unblacklist_locator_record_if_any ⇒ void
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 blacklisted customer.
Validations:
27 |
# File 'app/models/locator_black_list_party.rb', line 27 validates :customer_id, presence: true |
Instance Method Details
#blacklist_locator_record_if_any ⇒ void
This method returns an undefined value.
33 34 35 36 37 38 |
# File 'app/models/locator_black_list_party.rb', line 33 def blacklist_locator_record_if_any # if inform_customer # self.customer.locator_record.send_blacklist_notice # end customer.locator_record&.blacklist end |
#customer ⇒ Customer
23 |
# File 'app/models/locator_black_list_party.rb', line 23 belongs_to :customer, optional: true, inverse_of: :locator_black_listing |
#not_a_homeowner ⇒ nil (protected)
56 57 58 |
# File 'app/models/locator_black_list_party.rb', line 56 def not_a_homeowner errors.add("Customer is a homeowner", "cannot be black listed") if customer.is_homeowner? end |
#not_already_whitelisted ⇒ nil (protected)
51 52 53 |
# File 'app/models/locator_black_list_party.rb', line 51 def not_already_whitelisted errors.add("Customer is already white listed", "cannot be black listed") if customer.locator_white_listing end |
#unblacklist_locator_record_if_any ⇒ void
This method returns an undefined value.
41 42 43 44 45 46 |
# File 'app/models/locator_black_list_party.rb', line 41 def unblacklist_locator_record_if_any # if inform_customer # self.customer.locator_record.send_unblacklist_notice # end customer.locator_record&.unblacklist end |