Added compatibility with Active Record 4.0.0