mardi 20 octobre 2015

How can I find out why my Rails controller is returning a 500 error code?

In testing, a call to session.get root_path is returning a 500 error code, i.e. assert session.response.success? is failing.

This used to be fine, so clearly I have broken something, but I’m having trouble narrowing down the cause for the following reasons:

  • No exception is being thrown.
  • The value of session.response.body is correct (i.e. it contains the correctly-rendered HTML I was expecting from the render template: ... call in the controller.

In other words, nothing appears to have actually gone wrong, but still there is a 500 HTTP response.

Note: I am setting status = :success (or some other value) earlier in the controller action, which is then passed to render as status: status. This is because I am detecting possible unauthorized access based on some stuff in the session.

Aucun commentaire:

Enregistrer un commentaire