title: what should i be using instead of a global variable in my rails3 app?
body: <p>I have a rails 3 app that is using sub domains for each account.</p>
  
  <p>When a visitor visits a subdomain eg acme.domain.com, i lookup the subdomain from the database using the request.subdomain.   I then store the subdomain id in a glabla variable.</p>
  
  <p>I do this as i need access to this variable from controller, views and models so i can scope everything to just this subdomain.  eg just users, companies, pages etc for this subdomain.</p>
  
  <p>From what i hear using globals is bad design and can be buggy etc, but what should i use instead in this case ?</p>
  
  <p>please can anyone help ?</p>
  
  <p>best regards
  rick</p>