I have a model called TimesheetCorrection which has date column, a user_id column, hours column.
There is also a timesheet model which has the same columns. What I want to do is do a belongs_to :timesheet on the TimesheetCorrection model based on
WHERE timesheets.user_id = timesheet_corrections.user_id AND timesheets.date = timesheet_corrections.date
What would the syntax be to achieve that with active record?
Aucun commentaire:
Enregistrer un commentaire