Rails 4.0.0 Support

I have add a few commits to allow for use with active record version for rails 4