Remove method ApplicationController#guest_account
This commit is contained in:
parent
dd0d7fe6fb
commit
be4d382dd0
2 changed files with 4 additions and 8 deletions
|
@ -19,17 +19,13 @@ private
|
||||||
|
|
||||||
def current_account
|
def current_account
|
||||||
@current_account ||= current_user&.account
|
@current_account ||= current_user&.account
|
||||||
end
|
@current_account ||= Account.guests.find_by(id: session[:guest_account_id])
|
||||||
|
|
||||||
def guest_account
|
|
||||||
@guest_account ||= current_account
|
|
||||||
@guest_account ||= Account.guests.find_by(id: session[:guest_account_id])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def pundit_user
|
def pundit_user
|
||||||
@pundit_user ||= ApplicationPolicy::Context.new(
|
@pundit_user ||= ApplicationPolicy::Context.new(
|
||||||
account: current_account,
|
account: current_account&.guest? ? nil : current_account,
|
||||||
guest_account: guest_account,
|
guest_account: current_account,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ class MembershipAppsController < ApplicationController
|
||||||
def create
|
def create
|
||||||
@membership_app = MembershipApp.new permitted_attributes MembershipApp
|
@membership_app = MembershipApp.new permitted_attributes MembershipApp
|
||||||
|
|
||||||
@membership_app.account = guest_account || Account.new
|
@membership_app.account = current_account || Account.new
|
||||||
|
|
||||||
authorize @membership_app
|
authorize @membership_app
|
||||||
|
|
||||||
|
|
Reference in a new issue