Use Current association in AccountsController and add tests (#298)

* Add PagesControllerTest with authentication

* Rubocop fixes

* Move sign_in to setup block

* Remove instance variable

* Add tests for AccountsController

* Use specific account
This commit is contained in:
Dwight Watson
2024-02-05 11:00:40 +11:00
committed by GitHub
parent fb7411e163
commit 1cded2af90
2 changed files with 26 additions and 1 deletions

View File

@@ -17,7 +17,7 @@ class AccountsController < ApplicationController
end
def create
@account = Account.new(account_params.merge(family: Current.family))
@account = Current.family.accounts.build(account_params)
@account.accountable = account_params[:accountable_type].constantize.new
if @account.save