Last active
December 14, 2015 12:48
-
-
Save kinopyo/5088737 to your computer and use it in GitHub Desktop.
Notes: how to setup user based subdomain, http://stackoverflow.com/a/7265381/219065
This file contains hidden or 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
module AppName | |
class UserSubdomainConstraint | |
def self.matches?( request ) | |
request.subdomain.present? && request.subdomain != 'www' | |
end | |
end | |
end | |
AppName::Application.routes.draw do | |
devise_for :users | |
constraints(AppName::UserSubdomainConstraint) do | |
# THESE ARE THE ROUTES FOR USERS' SUBDOMAINS | |
end | |
end | |
def index | |
@user_account = User.where(:subdomain => request.subdomain).account | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment