Working Through Your Frustration

December 16, 2013

I was struggling yesterday trying to figure out how I could delete a word from my word app, but this morning I finally figured out what my issue was. When you use Rails scaffolding it created a before action inside of the words controller that called the method set_word and I didn’t notice this method call inside of the before action.

So to get my destroy action to work this morning I simply added this line:

@word = Word.find(params[:id])

I now see why there is a before action because this exact same line is also in the show method and so the extracted it out to keep things DRY. It’s amazing how such a simple little problem can slow you down, but when you take the time to work through your frustration the light at the end of the tunnel is well worth it.