Recently, I ran into a little roadblock as I’ve been cleaning up some bugs for one of my applications. I rely heavily on cross pollination of data between sites to drive traffic across my network. In this particular situation, a simple collection of linked image thumbnails accomplishes this task.
One of the helper methods that I use returns the file name of a supplied post object. To do this, I perform a regular expression match against the post’s URL and return the result.
# returns "icon/foo.jpg"
That worked great until my application would randomly throw a NoMethodError. I spent a while scratching my head, looking over my code, checking my SQL queries, and so on and so forth. Finally, I figured it out…I had forgotten to specify a case insensitive search!
# returns nil
=> #<MatchData "icon/bar.JPG">
I guess what they say is true…the Devil is in the details.