1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-25 08:09:38 +02:00

Account namespace updates: part 4 (transfers, singular namespacing) (#896)

* Move Transfer to Account namespace

* Fix partial resolution due to namespacing plurality

* Make category and tag controllers consistent with namespacing convention

* Update stale partial reference
This commit is contained in:
Zach Gollwitzer 2024-06-20 13:32:44 -04:00 committed by GitHub
parent dc3147c101
commit bddaab0192
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
50 changed files with 227 additions and 127 deletions

View file

@ -1,4 +1,4 @@
class Accounts::LogosController < ApplicationController
class Account::LogosController < ApplicationController
def show
@account = Current.family.accounts.find(params[:account_id])
render_placeholder

View file

@ -1,17 +1,17 @@
class TransfersController < ApplicationController
class Account::TransfersController < ApplicationController
layout "with_sidebar"
before_action :set_transfer, only: :destroy
def new
@transfer = Transfer.new
@transfer = Account::Transfer.new
end
def create
from_account = Current.family.accounts.find(transfer_params[:from_account_id])
to_account = Current.family.accounts.find(transfer_params[:to_account_id])
@transfer = Transfer.build_from_accounts from_account, to_account, \
@transfer = Account::Transfer.build_from_accounts from_account, to_account, \
date: transfer_params[:date],
amount: transfer_params[:amount].to_d,
currency: transfer_params[:currency],
@ -20,7 +20,10 @@ class TransfersController < ApplicationController
if @transfer.save
redirect_to transactions_path, notice: t(".success")
else
render :new, status: :unprocessable_entity
# TODO: this is not an ideal way to handle errors and should eventually be improved.
# See: https://github.com/hotwired/turbo-rails/pull/367
flash[:error] = @transfer.errors.full_messages.to_sentence
redirect_to transactions_path
end
end
@ -32,10 +35,10 @@ class TransfersController < ApplicationController
private
def set_transfer
@transfer = Transfer.find(params[:id])
@transfer = Account::Transfer.find(params[:id])
end
def transfer_params
params.require(:transfer).permit(:from_account_id, :to_account_id, :amount, :currency, :date, :name)
params.require(:account_transfer).permit(:from_account_id, :to_account_id, :amount, :currency, :date, :name)
end
end

View file

@ -1,4 +1,4 @@
class Categories::DeletionsController < ApplicationController
class Category::DeletionsController < ApplicationController
layout "with_sidebar"
before_action :set_category

View file

@ -1,4 +1,4 @@
class Categories::DropdownsController < ApplicationController
class Category::DropdownsController < ApplicationController
before_action :set_from_params
def show

View file

@ -1,4 +1,4 @@
class Tags::DeletionsController < ApplicationController
class Tag::DeletionsController < ApplicationController
layout "with_sidebar"
before_action :set_tag

View file

@ -1,4 +1,4 @@
class Transactions::RowsController < ApplicationController
class Transaction::RowsController < ApplicationController
before_action :set_transaction, only: %i[ show update ]
def show

View file

@ -0,0 +1,6 @@
class Transaction::RulesController < ApplicationController
layout "with_sidebar"
def index
end
end

View file

@ -1,6 +0,0 @@
class Transactions::RulesController < ApplicationController
layout "with_sidebar"
def index
end
end