|
4 | 4 | #
|
5 | 5 | # Table name: session_attendances
|
6 | 6 | #
|
7 |
| -# id :bigint not null, primary key |
8 |
| -# attending :boolean not null |
9 |
| -# created_at :datetime not null |
10 |
| -# updated_at :datetime not null |
11 |
| -# patient_session_id :bigint not null |
12 |
| -# session_date_id :bigint not null |
| 7 | +# id :bigint not null, primary key |
| 8 | +# attending :boolean not null |
| 9 | +# created_at :datetime not null |
| 10 | +# updated_at :datetime not null |
| 11 | +# patient_id :bigint not null |
| 12 | +# session_date_id :bigint not null |
13 | 13 | #
|
14 | 14 | # Indexes
|
15 | 15 | #
|
16 |
| -# idx_on_patient_session_id_session_date_id_be8bd21ddf (patient_session_id,session_date_id) UNIQUE |
17 |
| -# index_session_attendances_on_session_date_id (session_date_id) |
| 16 | +# index_session_attendances_on_patient_id (patient_id) |
| 17 | +# index_session_attendances_on_session_date_id (session_date_id) |
18 | 18 | #
|
19 | 19 | # Foreign Keys
|
20 | 20 | #
|
21 |
| -# fk_rails_... (patient_session_id => patient_sessions.id) |
| 21 | +# fk_rails_... (patient_id => patients.id) |
22 | 22 | # fk_rails_... (session_date_id => session_dates.id)
|
23 | 23 | #
|
24 | 24 | class SessionAttendance < ApplicationRecord
|
25 |
| - audited associated_with: :patient_session |
| 25 | + audited associated_with: :patient |
26 | 26 |
|
27 |
| - belongs_to :patient_session |
| 27 | + belongs_to :patient |
28 | 28 | belongs_to :session_date
|
29 | 29 |
|
30 |
| - has_one :session, through: :patient_session |
31 |
| - has_one :patient, through: :patient_session |
| 30 | + has_one :session, through: :session_date |
32 | 31 | has_one :location, through: :session
|
33 | 32 |
|
34 | 33 | scope :today, -> { joins(:session_date).merge(SessionDate.today) }
|
|
0 commit comments