Changes to Active record rails 4.0.2, fixes #2