Does this also fix the error for you?

```ruby
include ::Rake::DSL if defined?(::Rake)
```

I wonder if `Rails::Rake` is getting defined somewhere, which would cause `Rake` to resolve to the namespaced constant instead of the top level.