dimanche 10 mai 2015

why "Completed 406 Not Acceptable" has gone after removing respond_to?

when I used $.ajax() to submit the form's content with the following respond_to block:

respond_to do 
  render :json => { :url => question_path(resource, :recent => :true),
          :uploadPath => question_path(@question, :format => "json"),
          :editPath => edit_question_path(@question),
          :exitPath => question_path(resource)
  }
end

I got a error:

Completed 406 Not Acceptable in 124690.7ms (Views: 0.4ms | ActiveRecord: 16.7ms | Sphinx: 0.0ms)

After I removed respond_to, as the above code is changed into:

  render :json => { :url => question_path(resource, :recent => :true),
          :uploadPath => question_path(@question, :format => "json"),
          :editPath => edit_question_path(@question),
          :exitPath => question_path(resource)
  }

The error has gone, why this happens? what things I miss? Thank you!

Aucun commentaire:

Enregistrer un commentaire