SuperPumpup (dot com)
General awesomeness may be found here.

14 February 2013

The Wrong Way To Do STI

I'm almost through an epic legacy data migration (that's quite interesting and I think I'll write something up about when I'm done). I'm on the very last customer data model. I have found a good deal of clunkiness in the old application, but nothing too egregious.

Then I Find This Gem

def set_type
  self.type = some_association.id == 33 ? "SomeSubtype" : "SomeOtherSubtype"
end

Oof. Talk about coupling your data to your application.

Categories: Ruby on Rails