I have to create some type user friendly way of getting the user to login to there location.
Using devise for authentication. Company has subdomain field. Currently, if user signs in root, they also have to signin to the subdomain too.
Ideally, a user gets to the login screen and after they sign in, I could redirect them to the companies index controller. When they select a company, it redirects them to that companies subdomain and logs them in there.
Is there a way to store the login credentials and pass them to the subdomain after they select the subdomain?
Edit -
class Company < ActiveRecord::Base
attr_accessible :name, :subdomain, :parent_id
end
class CompaniesController < ApplicationController
def show
@company = Company.find_by_subdomain!(request.subdomain)
end
end
User such as District Manager can login and manage many companies. An employee can only login to a single company.
Being done so Manager can see what the other stores / companies are doing, but not employees.