title: Why is my rails application not responding properly to the .js format in production environement?
body: <p>i have a very simple rails application that is ajax-based for some of it's functionality.
  When i'm using it from a development environment, everything runs as expected.
  However, something weird happens in production environment: when an ajax call is being made, the HTML (HAML based) layouts are being rendered instead of the js (Coffee based).</p>
  
  <p>When comparing the logs from production and development, it's obvious that there is something i'm doing wrong in the way the responses are handled, but i've been scratching my head for hours now without a clue.</p>
  
  <p>Let's say my request is: /software_tags/1/edit.js
  On my development logs, i can see (And the output is right, i get the expected javascript page):</p>
  
  <pre><code>Started GET "/software_tags/1/edit.js" for 127.0.0.1 at 2012-07-17 16:59:34 -0700
  Processing by SoftwareTagsController#edit as JS
    Parameters: {"id"=&gt;"1"}
    Rendered shared/_error_messages.haml (0.1ms)
    Rendered software_tags/_form.haml (4.5ms)
    Rendered software_tags/edit.js.coffee (5.7ms) &lt;---- THIS IS GOOD!
  Completed 200 OK in 10ms (Views: 8.1ms | ActiveRecord: 0.4ms)
  </code></pre>
  
  <p>On my development logs however, i see (And the output is wrong, i get the HTML page):</p>
  
  <pre><code>Started GET "/software_tags/1/edit.js" for x.x.x.x at 2012-07-18 01:59:54 +0200
  Processing by SoftwareTagsController#edit as JS &lt;--- Wouldn't that force the edit.js.coffee to be rendered instead of the edit.haml?
    Parameters: {"id"=&gt;"1"}
    Rendered shared/_error_messages.haml (0.1ms)
    Rendered software_tags/_form.haml (2.8ms)
    Rendered software_tags/edit.haml (3.2ms)      &lt;---- THIS IS WRONG!
  Completed 200 OK in 5ms (Views: 3.5ms | ActiveRecord: 0.5ms)
  </code></pre>
  
  <p>In my controller, the edit action looks like this:</p>
  
  <pre><code>  def edit
      respond_to do |format|
        format.js
        format.html
        format.json { render json: @software_tag }
      end
    end
  </code></pre>
  
  <p>When i try to access json data however, everything is fine from all the environments, so what could be the problem with the wrong output for the js output?</p>
  
  <p>EDIT: Maybe i'm missing something fairly simple. i'm still unable to achieve what is working in development from my production environement. i'm using ruby 1.9.3 with Rails 3.2.6, along with jQuery / jQuery-ujs. Basically, i would refine my question: when making link_to remote: true, how can i force the server to answer me with a javascript file (And branch on the respond_to.js block instead of the html one)?</p>