Closed veeral-patel closed 5 years ago
I'm not sure if this going to work but:
you can try with subdomain exclusion https://github.com/influitive/apartment#switch-on-subdomain and setting a group and using a constrain for your www routes
constraints :subdomain => "www" do
resources :something
end
@lcjury thanks! here's my solution:
class WorkspaceConstraint
def self.matches?(request)
subdomains = %w{ admin www }
request.subdomain.present? && !subdomains.include?(request.subdomain)
end
end
Rails.application.routes.draw do
constraints WorkspaceConstraint do
resources :messages
resources :channels
end
constraints :subdomain => 'admin' do
resources :workspaces
end
constraints :subdomain => 'www' do
# static page routes
end
constraints :subdomain => '' do
# redirect
end
end
Imagine you're creating Slack, and have:
Thank you for this project! This may have been answered already, but I searched the previous issues and didn't find anything.
Essentially, what I want is:
www.mysite.com
-> render my site's static landing page*.mysite.com
-> render the appropriate subdomainHow would I set something like this up?