Rails 4 compatibility

Update ActiveRecord wrapper for compatibility with Rails 4+.