Tag Archives: active record

Enumerable Anti-Patterns

Enumerable methods are one of my favorite parts of Ruby. Enumerable anti-patterns, however, can make things not-so-fun. Let’s explore some ways these helpful tools are abused, and how to fix them. Enumerable anti-patterns #1: Don’t use a shovel as a … Continue reading

Posted in Uncategorized | Tagged , , , | Leave a comment

Lessons Learned about Timestamps

I ran into an extremely frustrating issue lately where some Rails code periodically behaved in a very unexpected way. After trying everything I could think of, I ran some code in the console to list the occurrences of the behavior, … Continue reading

Posted in Uncategorized | Tagged , , , , , , | Leave a comment

Override a Model’s destroy Method Without Losing Callbacks

I needed to do this in Rails 2, and had trouble finding any anything about how it could be done. I did eventually find some information, so I thought I’d share. Here’s how it looked for me:

  Also … Continue reading

Posted in Uncategorized | Tagged , , , , , | Leave a comment