Added counter_cache for user jobs, replaced count with size to use cache.

This commit is contained in:
2024-09-17 23:36:45 +02:00
parent 70dd3a0ab8
commit bd58c9d0c6
9 changed files with 31 additions and 26 deletions

View File

@@ -1,6 +1,6 @@
class Job < ApplicationRecord
belongs_to :operator, class_name: "User", optional: true
belongs_to :costumer, class_name: "User", optional: true
belongs_to :operator, class_name: "User", optional: true, counter_cache: :jobs_as_operator_count
belongs_to :costumer, class_name: "User", optional: true, counter_cache: :jobs_as_costumer_count
has_one_attached :pdf, dependent: :purge