Fix to work with query cache.

End support for ActiveRecord 2.x

Add support for ActiveRecord 4.0