Skip to content

Instantly share code, notes, and snippets.

@tubbo
Created October 12, 2011 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tubbo/1282782 to your computer and use it in GitHub Desktop.
Save tubbo/1282782 to your computer and use it in GitHub Desktop.
def confirm_current_user_account
case @customer_account.customer_type
when 'User' then
if @customer_account.customer == current_user
@customer = @customer_account
else
redirect_to bank_root_path, alert: "Error."
end
when 'Company'
unless current_user.companies.find(@customer_account.customer).nil?
@customer = @customer_account
else
redirect_to bank_root_path, alert: "Error."
end
else
redirect_to bank_root_path, alert: "Error."
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment