mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Update has_many_through on Schedule
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
class Schedule < ActiveRecord::Base
|
||||
has_paper_trail meta: { custom_data: proc { |schedule| schedule.order_cycle_ids.to_s } }
|
||||
|
||||
has_many :order_cycles, through: :order_cycle_schedules
|
||||
has_many :order_cycle_schedules, dependent: :destroy
|
||||
|
||||
has_many :order_cycles, through: :order_cycle_schedules
|
||||
has_many :coordinators, -> { uniq }, through: :order_cycles
|
||||
|
||||
scope :with_coordinator, lambda { |enterprise| joins(:order_cycles).where('coordinator_id = ?', enterprise.id).select('DISTINCT schedules.*') }
|
||||
|
||||
Reference in New Issue
Block a user