From 1220e0e8fe36f86d9e01b545e0d7dbdb3cd4b98f Mon Sep 17 00:00:00 2001 From: Nicolas Florentin Date: Fri, 29 Sep 2023 15:26:36 +0200 Subject: [PATCH] Fix a bug: when calling .to_json on an "avoir", there was a bug because order_number delegates on invoice which can be nil, it was causing errors in notifications rendering --- CHANGELOG.md | 1 + app/models/avoir.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7bc06d14..6e3f4bbd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fix a bug: minor pb (exception raised) when bot hit api/projects#search without beeing authenticated - Fix a bug: minor pb (exception raised) when a bot or unauthenticated user hit api/auth_providers actions +- Fix a bug: when calling .to_json on an "avoir", there was a bug because order_number delegates on invoice which can be nil, it was causing errors in notifications rendering ## v6.1.1 2023 September 28 diff --git a/app/models/avoir.rb b/app/models/avoir.rb index 7c731e69f..7fce27de0 100644 --- a/app/models/avoir.rb +++ b/app/models/avoir.rb @@ -12,7 +12,7 @@ class Avoir < Invoice attr_accessor :invoice_items_ids - delegate :order_number, to: :invoice + delegate :order_number, to: :invoice, allow_nil: true def expire_subscription user.subscription.expire