Search code examples
ruby-on-railsdnssubdomain

Rails creating a user specific domain when user logs in


I have created a blog blog.com, when a user logs in , I need to create a domain for this user, like username.blog.com, and he can customize this url, like anywords.blog.com, what can I do for this?


Solution

  • You should use some kind of route constraint checking for subdomain. Check Rails routing documentation for that kind of feature: http://guides.rubyonrails.org/routing.html#advanced-constraints