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
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 about 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 been 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]
end