Class: Naf::ApplicationSchedulePrerequisite

Inherits:
NafBase
  • Object
show all
Defined in:
app/models/naf/application_schedule_prerequisite.rb

Class Method Summary collapse

Methods inherited from NafBase

full_table_name_prefix

Class Method Details

.pickleables(pickler) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'app/models/naf/application_schedule_prerequisite.rb', line 25

def self.pickleables(pickler)
      return self.joins([application_schedule: :application]).
where('applications.deleted = false').
where(
  "NOT EXISTS(
     SELECT
       1
     FROM
       #{::Naf.schema_name}.application_schedules AS a_s
     WHERE
       application_schedule_prerequisites.prerequisite_application_schedule_id = a_s.id AND
     EXISTS(
       SELECT
         1
       FROM
         #{::Naf.schema_name}.applications AS a
       WHERE
         a_s.application_id = a.id AND
           deleted IS TRUE
     )
  )"
)
end