From 0761e8c2375c1e0c7f53bf92dcd4eb00ce9f3437 Mon Sep 17 00:00:00 2001 From: Alex Kreidler Date: Mon, 13 Apr 2026 04:31:00 -0700 Subject: [PATCH] Fix transactions page crash when no accounts exist (#1453) Skip the accessible_account_ids filter when the array is empty, preventing Rails from creating a "none" relation that causes .take to return nil. An empty [] is truthy in Ruby, so `if accessible_account_ids` was applying a WHERE account_id IN () clause that matched nothing. Fixes #1452 Co-authored-by: Claude Opus 4.6 --- app/models/transaction/search.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/transaction/search.rb b/app/models/transaction/search.rb index d60e39fb4..43dfdd78b 100644 --- a/app/models/transaction/search.rb +++ b/app/models/transaction/search.rb @@ -30,7 +30,7 @@ class Transaction::Search query = family.transactions.merge(Entry.excluding_split_parents) # Scope to accessible accounts when provided - query = query.where(entries: { account_id: accessible_account_ids }) if accessible_account_ids + query = query.where(entries: { account_id: accessible_account_ids }) if accessible_account_ids&.any? query = apply_active_accounts_filter(query, active_accounts_only) query = apply_category_filter(query, categories)