mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 05:09:38 +02:00
* Add backend for property account details
* Rubocop updates
* Add property form with details
* Revert "Rubocop updates"
This reverts commit 05b0b8f3a4
.
* Bump brakeman to latest version
* Add overview section to property view
* Lint fixes
24 lines
507 B
Ruby
24 lines
507 B
Ruby
class Address < ApplicationRecord
|
|
belongs_to :addressable, polymorphic: true
|
|
|
|
validates :line1, :locality, presence: true
|
|
validates :postal_code, presence: true, if: :postal_code_required?
|
|
|
|
def to_s
|
|
I18n.t("address.format",
|
|
line1: line1,
|
|
line2: line2,
|
|
county: county,
|
|
locality: locality,
|
|
region: region,
|
|
country: country,
|
|
postal_code: postal_code
|
|
)
|
|
end
|
|
|
|
private
|
|
|
|
def postal_code_required?
|
|
country.in?(%w[US CA GB])
|
|
end
|
|
end
|