Class: LocatorBlackListParty

Inherits:
ApplicationRecord show all
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

#creator, #updater

Instance Method Summary collapse

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

#publish_event

Instance Method Details

#blacklist_locator_record_if_anyObject



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

#customerCustomer

Returns:

See Also:



22
# File 'app/models/locator_black_list_party.rb', line 22

belongs_to :customer, optional: true, inverse_of: :locator_black_listing

#not_a_homeownerObject (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_whitelistedObject (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_anyObject



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