Re: How to make a per-request variable globally available?

Aaron
2007-02-08T16:07:32Z

>   # makes @site available to all controllers and views
>   def initialize_site
>     @site = Site.find_by_domain(request.domain)
>   end
> end
>

You can use Thread.current to pass data to your models.  Something
like this:

def initialize_site
  @site = Site.find_by_domain(request.domain)
  Thread.current[:site] = @site
end

Aaron