Created
August 8, 2018 23:11
-
-
Save tiagogeraldi/3f9c7b4c34a006c4437f521fb0437b3a to your computer and use it in GitHub Desktop.
Part of Apartment with no subdomain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TenantSessionsController < ApplicationController | |
skip_before_action :tenant_session | |
#layout 'devise' | |
def new | |
# clean any logged user up | |
reset_session | |
end | |
def create | |
if Customer.find_by(name: tenant_params[:name]) | |
session[:tenant] = tenant_params[:name] | |
redirect_to root_path | |
else | |
flash[:error] = 'Customer not found' | |
redirect_to [:new, :tenant_session] | |
end | |
end | |
protected | |
def tenant_params | |
params.require(:tenant).permit(:name) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment