Class: LocatorWhiteListParty

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

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

#customerCustomer

Returns:

See Also:



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

belongs_to :customer, optional: true, inverse_of: :locator_white_listing

#not_a_homeownerObject (protected)



48
49
50
51
52
# File 'app/models/locator_white_list_party.rb', line 48

def not_a_homeowner
  if self.customer.is_homeowner?
    errors.add("Customer is a homeowner", "cannot be white listed")
  end
end

#not_blacklistedObject (protected)



42
43
44
45
46
# File 'app/models/locator_white_list_party.rb', line 42

def not_blacklisted
  if self.customer.locator_black_listing
    errors.add("Customer is already black listed", "cannot be white listed")
  end
end

#whitelist_locator_record_if_anyObject



29
30
31
32
33
34
35
36
37
38
# File 'app/models/locator_white_list_party.rb', line 29

def whitelist_locator_record_if_any
  if self.customer.locator_record
    self.customer.locator_record.whitelist
  else
    CustomerLocatorUtility.create_default_locator_record customer
  end
  #if inform_customer
    #self.customer.locator_record.send_whitelist_notice
  #end
end