```ruby
$LOAD_PATH.unshift(File.dirname(__FILE__))

require 'rubygems'
require 'active_support'
require 'active_support/dependencies'
require 'active_support/core_ext/class/attribute_accessors'
require 'active_support/core_ext/module/delegation'
require 'active_record'
require 'active_record/connection_adapters/abstract/quoting'

require 'arel/algebra'
require 'arel/engines'
require 'arel/session'
```

Remove explicit rubygems require. Use Active Support provided by Active Record. Add self to load path after requiring Active Record.
user
```ruby
require 'active_record'
require 'active_record/connection_adapters/abstract/quoting'

$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'arel/algebra'
require 'arel/engines'
require 'arel/session'
```
assistant