When we return JSON output using render :json =>@profiles, the
output will return the required results with a 406 error. How can
avoid that ‘406 Not Acceptable’ error ?
When we return JSON output using render :json =>@profiles , the output will return
Share
I’m more than sure that you have this problem.
Explanations:
Say your controller only returns json answers
This will return the json as soon as:
/path_to_action.jsonis called/path_to_actionis called with headersContent-Type:application/json;and probably some other header types (Eg.X-Requested-With:XMLHttpRequest)Otherwise, it returns a
406 Not Acceptableerror.To avoid the issue, if your controller only returns json, write:
otherwise, use
/path_to_action.jsoninstead.