Doing things in models on save/update
So, I wanted to do some sweet gsubbing before the save of projects in Rails. I found the API docs had a wealth of information about this, but I figured I’d post my method anyway: before_create :fix_amount before_update :fix_amount Now you just define them under private in the model: def fix_amount self.amount.gsub!(/^\$/, "") end This takes those pesky $’s right out, back to the back yard where they belong.

