```ruby
require 'rails'
require 'active_record/railtie'

Bundler.require

app = Class.new(Rails::Application)
app.config.active_support.deprecation = :log
app.load_tasks

Rake::Task['environment'].enhance do
  app.initialize!
end
```

Remove Bundler.require call. Makes no sense inside a gem.
user
```ruby
require 'rails'
require 'active_record/railtie'

app = Class.new(Rails::Application)
app.config.active_support.deprecation = :log
app.load_tasks

Rake::Task['environment'].enhance do
  app.initialize!
end
```
assistant