2024-08-23 08:47:08 -04:00
|
|
|
class PropertiesController < ApplicationController
|
2024-11-04 20:27:31 -05:00
|
|
|
include AccountableResource
|
2024-08-23 08:47:08 -04:00
|
|
|
|
2024-11-04 20:27:31 -05:00
|
|
|
permitted_accountable_attributes(
|
|
|
|
:id, :year_built, :area_unit, :area_value,
|
|
|
|
address_attributes: [ :line1, :line2, :locality, :region, :country, :postal_code ]
|
|
|
|
)
|
2024-08-23 08:47:08 -04:00
|
|
|
|
2024-11-04 20:27:31 -05:00
|
|
|
def new
|
|
|
|
@account = Current.family.accounts.build(
|
|
|
|
currency: Current.family.currency,
|
|
|
|
accountable: Property.new(
|
|
|
|
address: Address.new
|
|
|
|
),
|
|
|
|
institution_id: params[:institution_id]
|
|
|
|
)
|
2024-08-23 08:47:08 -04:00
|
|
|
end
|
|
|
|
|
2024-11-04 20:27:31 -05:00
|
|
|
def edit
|
|
|
|
@account.accountable.address ||= Address.new
|
2024-08-23 08:47:08 -04:00
|
|
|
end
|
|
|
|
end
|