I have a client who needs the same custom CMS developed for about 5 apps. All apps will have a "similar" but different look and feel and I'd really like to have 1 rails application handle this and just modify the layout/views as needed. Is there a gem/plugin or a precedent for this?
You could start with DHH's Account Location plugin as a start, but modify it to use the Top Level Domain name (TLD) instead of a subdomain. Its a very simple library, but it gets the job done. Just be sure to scope all your finds in your app by the Account
associated with the domain name.
Doug's suggestion will work if the differences between the sites are purely style and static-content -- e.g., if you're basically just "skinning". But I'd be cautious following that approach if the differences will be more involved than that. You could very easily end up with a maintenance nightmare, with all your business logic surrounded by case statements and lots of special case code spread through your application. And you'd really feel the pain if you ever wanted to separate the sites onto different servers or make significant functional changes to some of the sites but not others.
If you anticipate any significant differences between the sites, you might want to consider developing them as separate Rails projects with shared components. Put the code that they'll share into gems or plugins, and reserve the separate projects for the attributes they don't share. For a small increase in overhead up front, you'd buy yourself a lot more flexibility down the road.
I built something specifically for this purpose a few years ago. I haven't touched it in a while, but there's some network activity on github. Rails Multisite Plugin