fix: Rule notification should not be triggered when category is unassigned #2214

Merged
the-spectator merged 1 commits from fix/cta into main 2025-05-06 21:15:15 +08:00
the-spectator commented 2025-05-06 13:14:28 +08:00 (Migrated from github.com)

Motiviation

Currently, when a transaction's category is changed, the rule CTA (category_rule) is triggered. However, it incorrectly assumes that a category is always present, which causes issues when the category is unassigned (i.e., nil). This leads to an error when transaction.category is nil.

flash[:cta] = {
          type: "category_rule",
          category_id: transaction.category_id,
          category_name: transaction.category.name
        }
## Motiviation Currently, when a transaction's category is changed, the rule CTA (category_rule) is triggered. However, it incorrectly assumes that a category is always present, which causes issues when the category is unassigned (i.e., nil). This leads to an error when transaction.category is `nil`. ``` flash[:cta] = { type: "category_rule", category_id: transaction.category_id, category_name: transaction.category.name } ```
zachgoll (Migrated from github.com) approved these changes 2025-05-06 21:15:09 +08:00
zachgoll (Migrated from github.com) left a comment

Good catch!

Good catch!
Sign in to join this conversation.