1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 05:09:38 +02:00
Maybe/app/controllers/accounts_controller.rb
Nikhil Badyal 26762477a3
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions
Preference to set default_period (#1941)
2025-03-07 10:05:54 -05:00

44 lines
760 B
Ruby

class AccountsController < ApplicationController
before_action :set_account, only: %i[sync chart sparkline]
include Periodable
def index
@manual_accounts = family.accounts.manual.alphabetically
@plaid_items = family.plaid_items.ordered
render layout: "settings"
end
def sync
unless @account.syncing?
@account.sync_later
end
redirect_to account_path(@account)
end
def chart
render layout: "application"
end
def sparkline
render layout: false
end
def sync_all
unless family.syncing?
family.sync_later
end
redirect_to accounts_path
end
private
def family
Current.family
end
def set_account
@account = family.accounts.find(params[:id])
end
end