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
Belongs to collapse
Methods included from Models::Auditable
Instance Method Summary collapse
- #blacklist_locator_record_if_any ⇒ Object
- #not_a_homeowner ⇒ Object protected
- #not_already_whitelisted ⇒ Object protected
- #unblacklist_locator_record_if_any ⇒ Object
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::EventPublishable
Instance Method Details
#blacklist_locator_record_if_any ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'app/models/locator_black_list_party.rb', line 29 def blacklist_locator_record_if_any if self.customer.locator_record self.customer.locator_record.blacklist #if inform_customer #self.customer.locator_record.send_blacklist_notice #end end end |
#customer ⇒ Customer
22 |
# File 'app/models/locator_black_list_party.rb', line 22 belongs_to :customer, optional: true, inverse_of: :locator_black_listing |
#not_a_homeowner ⇒ Object (protected)
55 56 57 58 59 |
# File 'app/models/locator_black_list_party.rb', line 55 def not_a_homeowner if self.customer.is_homeowner? errors.add("Customer is a homeowner", "cannot be black listed") end end |
#not_already_whitelisted ⇒ Object (protected)
49 50 51 52 53 |
# File 'app/models/locator_black_list_party.rb', line 49 def not_already_whitelisted if self.customer.locator_white_listing errors.add("Customer is already white listed", "cannot be black listed") end end |
#unblacklist_locator_record_if_any ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'app/models/locator_black_list_party.rb', line 38 def unblacklist_locator_record_if_any if self.customer.locator_record self.customer.locator_record.unblacklist #if inform_customer #self.customer.locator_record.send_unblacklist_notice #end end end |