title: 406 Not acceptable after format.js
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1414446/weird-406-not-acceptable-error">Weird &ldquo;406 not acceptable&rdquo; error</a>  </p>
  </blockquote>
  
  
  
  <p>I receive a "406 Not acceptable" error after doing a respond_to with a format.js. This is the link:</p>
  
  <pre><code>    &lt;%= link_to I18n.t(:alert_dismiss), :controller =&gt; 'alerts', :action =&gt; 'dismiss', :id =&gt; @alert, :remote =&gt; :true %&gt;
  </code></pre>
  
  <p>This is the dismiss action from the alerts controller:</p>
  
  <pre><code>  # Sets alert dismiss status to true
    def dismiss
      # Get alert data
      @alert = Alert.find(params[:id])
  
      # Update status
      @alert.update_attribute(:dismiss, true)
      @alert.save!
  
      respond_to do |format|
        format.js
      end
  
    end
  </code></pre>
  
  <p>And this is dismiss.js.erb:</p>
  
  <pre><code>$('.systemalert').empty();
  </code></pre>
  
  <p>Any idea what's wrong? Thanks!</p>