← all posts

5 September 2013

Debugging Rails Controllers

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

— Ryan

Got a thought? Email me or find me on Mastodon.

Before this: Bundler local paths

After this: Order adjustments within Spree