Debugging Rails Controllers

05 Sep 2013

Here's my flow for debugging a misbehaving controller. Imagine that there's a form at app/views/messages/new.html.erb that is posting to MessagesController#create. The parameters aren't being passed through from the form to the controller, and the model is raising a validation error saying that a field is blank -- even though it's clearly not.

Step 0: Does restarting the server fix the problem?

Step 1: Check the form

Step 2: Check the controller

Step 3: Check the model

blog comments powered by Disqus