title: Rails & Heroku - Find User By Lowercase Username
body: <p>in rails development environment I find a user by its lowercased username in the routes.</p>
  
  <p>For example:</p>
  
  <pre><code>@user = User.find_by_username(params[:id].downcase)
  </code></pre>
  
  <p>This piece of code runs perfectly fine in development, but when this code runs in production (Heroku) I get </p>
  
  <blockquote>
    <p>ActionView::Template::Error (undefined method `username' for nil:NilClass):</p>
  </blockquote>
  
  <p>Is there a go around for this issue?</p>