Fix monkeypatching to make database changes work with rails 4