1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 13:19:39 +02:00
Maybe/app/models/address.rb

19 lines
434 B
Ruby
Raw Normal View History

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