Routes question

Is it possible to have a RoR application serving two different
websites/domain names?

I’m creating a simple discussion group application… but I’d like my
RoR instance to be shared between these domains.

So, in my routes… can i pass down to my application what the domain
name is?

Entries in my database can then have a domain field!

In one of my ror apps, it handles multiple domains – I just check


Ah, thanks for the info Joe

I’ve been playing around with the new ActiveResource. Initially
thought I would determine the current domain in the routes.rb, but
looks like it’s best done in the controllers.

Will have to do a bit more thinking. Still a newbie to rails, so
hopefully I haven’t bitten off more than I can chew :slight_smile:

We did it using a before_filter in the ApplicationController and added a
table of domains to our database. That way, we can store basic info
the site in the database. Something like this:

before_filter :site
def site
#### get the site from the session, or from the domain if it hasn’t
loaded yet.
logger.warn(“The Domain is #{request.domain}”)
session[:site] = Site.find_by_domain(request.domain) unless
(session[:site] && session[:site].domain == request.domain)
@site = session[:site]


On 9/27/06, Jason B [email protected] wrote:

On 27/09/2006, at 7:52 PM, Joe R. MUDCRAP-CE wrote:


Ron M.
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs