title: how to get environment in javascript file in rails app
body: <p>hello ive been trying to get the current environment in rails but i think im doing something wrong with my javascript, but i dont seem to know what. in my application.js i have...</p>
  
  <pre><code>var rails_env = '&lt;%= Rails.env -%&gt;';
  alert(rails_env);
  alert(rails_env.value);
  if(rails_env == 'development'){
      alert('inside if')
      var indexName = "idx";
  }
  else{
      alert('inside else')
       var indexName = "idx_production";
  }
  </code></pre>
  
  <p>it always goes into my else statement even if i am in development mode. what am i doing wrong? thank you</p>
  
  <p>how to get environment in javascript file in rails app</p>