我是铁道和麻风病的新鲜事,我遇到以下挫折,同时试图在我的控制者中减少一些相当简单的麻风气要求。
我有以下法典:
respond_to do |format|
#format.html { render :json => db_clean_response.to_json }
format.json { render :json => db_clean_response.to_json }
end
When I try to debug this by manually entering the URL and parameters, the controller correctly prepares the response, but Rails responds with HTTP/406 Not Acceptable
unless I uncomment the format.html
command. (Note that the format.html
stuff is just for trying to fix this.)
I don t want this function responding with html, as its only for ajax stuff. Besides, Rails responds with the json uglyprinted onto empty html, and I d like to use a plugin like JSONView to prettify it.
这里的情况如何? 我认为,像理想的结果一样,结果非常简单,但有些地方却在夸张。 当我试图推翻一个jax时,我想我的浏览器将大坝的 j子拉开,而不要 la笑。