1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-02 20:15:22 +02:00

Fix: No comma when locality is empty (small fix) (#2111)
Some checks failed
Publish Docker image / ci (push) Has been cancelled
Publish Docker image / Build docker image (push) Has been cancelled

* Fix: No comma when locality is empty

* better cleanup on address string

* fix test to one-liner

* add more testing
This commit is contained in:
Luan Estradioto 2025-04-16 22:26:45 -03:00 committed by GitHub
parent 298e150f43
commit 6a21f26d2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 41 additions and 7 deletions

View file

@ -2,7 +2,7 @@ class Address < ApplicationRecord
belongs_to :addressable, polymorphic: true
def to_s
I18n.t("address.format",
string = I18n.t("address.format",
line1: line1,
line2: line2,
county: county,
@ -11,5 +11,8 @@ class Address < ApplicationRecord
country: country,
postal_code: postal_code
)
# Clean up the string to maintain I18n comma formatting
string.split(",").map(&:strip).reject(&:empty?).join(", ")
end
end