patches for working with ActiveRecord 4.0