|
13 | 13 | # notes :text default(""), not null
|
14 | 14 | # created_at :datetime not null
|
15 | 15 | # updated_at :datetime not null
|
16 |
| -# patient_session_id :bigint not null |
| 16 | +# patient_id :bigint not null |
17 | 17 | # performed_by_user_id :bigint not null
|
18 | 18 | # programme_id :bigint not null
|
| 19 | +# session_date_id :bigint not null |
19 | 20 | #
|
20 | 21 | # Indexes
|
21 | 22 | #
|
22 |
| -# index_gillick_assessments_on_patient_session_id (patient_session_id) |
| 23 | +# index_gillick_assessments_on_patient_id (patient_id) |
23 | 24 | # index_gillick_assessments_on_performed_by_user_id (performed_by_user_id)
|
24 | 25 | # index_gillick_assessments_on_programme_id (programme_id)
|
| 26 | +# index_gillick_assessments_on_session_date_id (session_date_id) |
25 | 27 | #
|
26 | 28 | # Foreign Keys
|
27 | 29 | #
|
28 |
| -# fk_rails_... (patient_session_id => patient_sessions.id) |
| 30 | +# fk_rails_... (patient_id => patients.id) |
29 | 31 | # fk_rails_... (performed_by_user_id => users.id)
|
30 | 32 | # fk_rails_... (programme_id => programmes.id)
|
| 33 | +# fk_rails_... (session_date_id => session_dates.id) |
31 | 34 | #
|
32 | 35 | class GillickAssessment < ApplicationRecord
|
33 |
| - audited associated_with: :patient_session |
| 36 | + audited associated_with: :patient |
34 | 37 |
|
35 |
| - belongs_to :patient_session |
| 38 | + belongs_to :patient |
| 39 | + belongs_to :session_date |
36 | 40 | belongs_to :programme
|
37 | 41 |
|
38 | 42 | belongs_to :performed_by,
|
39 | 43 | class_name: "User",
|
40 | 44 | foreign_key: :performed_by_user_id
|
41 | 45 |
|
42 |
| - has_one :patient, through: :patient_session |
43 |
| - has_one :session, through: :patient_session |
| 46 | + has_one :session, through: :session_date |
44 | 47 |
|
45 | 48 | delegate :academic_year, to: :session
|
46 | 49 |
|
|
0 commit comments