title: Rails: Detecting user agent works in development but not production?
body: <p>I am trying to detect Blackberry user agents in my app, which works fine in my development version. But nothing happens when I redeploy the app in production.</p>
  
  <p>application_helper.rb</p>
  
  <pre><code>  def blackberry_user_agent?
      request.env["HTTP_USER_AGENT"] &amp;&amp; request.env["HTTP_USER_AGENT"][/(Blackberry)/]
    end
  </code></pre>
  
  <p>application.html.erb</p>
  
  <pre><code>&lt;% if blackberry_user_agent? -%&gt;
  &lt;div class="message"&gt;
  &lt;p&gt;Using a Blackberry? &lt;a href="http://mobile.site.ca/"&gt;Use the mobile optimized version&lt;/a&gt;.&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I've tried clearing the cache using rake tmp:cache:clear and restarted mongrel a few times. Apparently the HTTP_USER_AGENT is coming back nil in production. I am using Nginx with a mongrel cluster.</p>