rails/rails — Issue #3918: Eager loading and multiple databases
Author: pimeys
Created: 2011-12-09 17:24:01+00:00
State: open

If using ActiveRecord with multiple databases, relations between the models will break randomly. For example, doing Model.includes(:another_model_in_other_database), sometimes AR will not do multiple selects, but a one single join (when eager_loading?). That join will break and it will cause random crashes in the application.

Now, I've fixed this with monkey patching:

```ruby
def eager_loading?
false
end
```

But this feels quite ugly. Is there a better way to do this or is there a bug in ActiveRecord?