mirror of
https://github.com/we-promise/sure.git
synced 2026-04-20 12:34:12 +00:00
Refactor clear_ai_cache to use family_scope pattern
- Move family-scoped queries to models via family_scope class method - Remove hardcoded model names from Enrichable concern - Replace inline rescue with proper respond_to? check - Add count tracking for better logging
This commit is contained in:
@@ -66,6 +66,11 @@ class Entry < ApplicationRecord
|
||||
pending.where("entries.date < ?", days.days.ago.to_date)
|
||||
}
|
||||
|
||||
# Family-scoped query for Enrichable#clear_ai_cache
|
||||
def self.family_scope(family)
|
||||
joins(:account).where(accounts: { family_id: family.id })
|
||||
end
|
||||
|
||||
# Auto-exclude stale pending transactions for an account
|
||||
# Called during sync to clean up pending transactions that never posted
|
||||
# @param account [Account] The account to clean up
|
||||
|
||||
Reference in New Issue
Block a user