All threads / Subdomains

Ask A Question


You’re not receiving notifications from this thread.


Jon Moss asked in Gems / Libraries

Let's say I have a scaffold called 'blogs', and blogs have an attribute called 'subdomain'. I want to have each blog be hosted at a subdomain; let's say I have a blog with a subdomain of 'gorails', the blog would be hosted at ( is the root). As well, would take you to blogs#show.

I've tried many different solutions to have this work, but none seem to work with Rails 4. Help?

Fantastic question and I think this is worthy of recording an episode (or two) on asap. One suggestion is the apartment gem but also it's wise to build this from scratch so you can have a good understanding of everything you need to consider when building a multi-tenant / subdomain app.

Hopefully I'll be able to record an episode for this next week!

Neat, thanks Chris! It'd also be super helpful if you showed how to do it a) from scratch and b) shared database

Hi Chris! Any update on the status of this?

Hey Jon,

Not yet! I've been busy with the holidays but I plan on starting to cover this in the next week.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 53,130+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2021 GoRails, LLC. All rights reserved.