Monthly Archives: August 2007

Preserve Semantics in Callbacks

Many people tend to place logic within a method named for the callback (e.g. after_destroy).  This works fine, but tends to be less maintainable, in my opinion. You basically have a method called after_destroy (or whatever), but you don’t readily … Continue reading

Posted in Ruby, Ruby on Rails | 1 Comment

Using Constants in Rails Models

One of my pet peeves in code is the absence of constants and thus the prevalence of “magic numbers” in their place. Constants add a touch of readability and semantic meaning and magnify the maintainability of the code. As a … Continue reading

Posted in Ruby, Ruby on Rails | 6 Comments