title: Where to initialize variables in Rails 3
body: <p>I've been discovering Ruby on Rails during the last 3 months and I'm fascinated. But several things I don't know which is the best way to do them. Now I'm stack with the initialization of  some variables. All the application is running over ajax, so all the instance variables should be initialize only once.</p>
  
  <p>I've tried writting a method 'initialize' in the applicationController which is run just once, but the problem is that I'm accesing the request object which is not initialized yet.</p>
  
  <p>I've tried a before_filter in the applicationController but it is run every request I do, even if it is an ajax request.</p>
  
  <p>Does anyone know how to initialize an instance variable with a value from the request object? Yes, probably a newbie question.</p>
  
  <p>I'm using Ruby 1.8.7 and Rails 3.
  Thanks in advance</p>