title: How to set global variables to use everywhere in my application?
body: <p>I am using Ruby on Rails 3 and I would like to set some global variable to use those everywhere in my application. In particular, the domain name.</p>
  
  <p>If, for example, my website URL is</p>
  
  <pre><code>http://subname.domain.com
  </code></pre>
  
  <p>I would like to set or retrieve the <code>subname.domain.com</code> value in order to use that in my application like this</p>
  
  <pre><code>request_uri = "http://#{sub_domain_name}"
  </code></pre>
  
  <p><strong>Where and how I have to state\initialize the <code>sub_domain_name</code> variable or other variables at all?</strong></p>