Update: rewritten question a bit. Trying to route my subdomains like below
- login.app.ltd
- user1.app.ltd
- user2.app.ltd
- signup.app.ltd
Using
- Rails 3.2
- Devise
To no avail tried several tutorials blog posts, anyone knows a working example for this?
Really stuck on this 🙁
this is my routes now:
match '', to: 'frontend#index', constraints: lambda { |r| r.subdomain.present? && ( r.subdomain != 'www') }
#match '' => 'home#index', :constraints => { :subdomain => 'login' }
constraints :subdomain => /^(?!signup\b)(\w+)/ do
root :to => "frontend#index"
end
root :to => "frontend#index"
My RailsApps project offers a complete example app showing how to use subdomains:
Rails Tutorial for Subdomains with Devise
Did you take a look at that?
config/routes.rb
lib/subdomain.rb