2024-07-25 16:46:04 -04:00
|
|
|
class Account::HoldingsController < ApplicationController
|
2024-07-26 18:00:41 +02:00
|
|
|
layout :with_sidebar
|
2024-07-25 16:46:04 -04:00
|
|
|
|
|
|
|
before_action :set_account
|
2024-10-09 14:59:18 -04:00
|
|
|
before_action :set_holding, only: %i[show destroy]
|
2024-07-25 16:46:04 -04:00
|
|
|
|
|
|
|
def index
|
|
|
|
@holdings = @account.holdings.current
|
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
2024-10-09 14:59:18 -04:00
|
|
|
def destroy
|
|
|
|
@holding.destroy_holding_and_entries!
|
|
|
|
redirect_back_or_to account_holdings_path(@account)
|
|
|
|
end
|
|
|
|
|
2024-07-25 16:46:04 -04:00
|
|
|
private
|
|
|
|
|
|
|
|
def set_account
|
|
|
|
@account = Current.family.accounts.find(params[:account_id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def set_holding
|
|
|
|
@holding = @account.holdings.current.find(params[:id])
|
|
|
|
end
|
|
|
|
end
|