Class: ViewServiceJob

Inherits:
ApplicationViewRecord show all
Includes:
Models::SearchableView
Defined in:
app/models/view_service_job.rb

Overview

== Schema Information

Table name: view_service_jobs
Database name: primary

id :integer primary key
business_phone :string(255)
cell_phone :string(255)
city :string(255)
completed_on :date
country_iso3 :string(3)
customer_full_name :string(255)
email :string(255)
home_phone :string(255)
job_date :datetime
measurecomp_job_number :string(255)
order_reference_number :string(255)
redemption_code :string(255)
reference_number :string(255)
sales_priority_index :integer
state :string(255)
state_code :string(20)
street1 :string(255)
street2 :string(255)
tstat_count :integer
zip :string(255)
created_at :datetime
updated_at :datetime
address_id :integer
business_phone_contact_point_id :integer
cell_phone_contact_point_id :integer
customer_id :integer
email_contact_point_id :integer
home_phone_contact_point_id :integer
order_id :integer
primary_sales_rep_id :integer
secondary_sales_rep_id :integer

Class Method Summary collapse

Methods included from Models::SearchableView

#crm_link, #crm_link_subtitle, #has_columns?, #main_resource, #readonly?

Methods inherited from ApplicationViewRecord

create, create!, #readonly?

Methods inherited from ApplicationRecord

ransackable_associations, ransackable_attributes, ransackable_scopes, ransortable_attributes, #to_relation

Methods included from Models::EventPublishable

#publish_event

Class Method Details

.contact_point_containsActiveRecord::Relation<ViewServiceJob>

A relation of ViewServiceJobs that are contact point contains. Active Record Scope

Returns:

See Also:



41
# File 'app/models/view_service_job.rb', line 41

scope :contact_point_contains, ->(detail) { where("EXISTS(select 1 from contact_points cp where cp.id IN (view_service_jobs.email_contact_point_id, view_service_jobs.home_phone_contact_point_id, view_service_jobs.cell_phone_contact_point_id, view_service_jobs.business_phone_contact_point_id) and cp.detail ilike ?)","%#{detail}%") }