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)
* 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:
parent
298e150f43
commit
6a21f26d2d
3 changed files with 41 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue