Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eager load issue after upgrading to Rails 6 #37222

Closed
xipgroc opened this issue Sep 17, 2019 · 1 comment
Closed

Eager load issue after upgrading to Rails 6 #37222

xipgroc opened this issue Sep 17, 2019 · 1 comment

Comments

@xipgroc
Copy link

xipgroc commented Sep 17, 2019

Steps to reproduce

cars.eager_load(:tires).joins('LEFT JOIN special_table ON tires.id = special_table.tire_id')

The application.rb file has 'config.load_defaults "6.0"' as suggested on the Upgrade to Rails 6 guide.

Expected behavior

It should take the 'tires.id' from the table 'tires' that has been previously eager loaded. This has been working until upgrading to Rails 6.

Actual behavior

Instead there's an error that as far as I understand it means that the table tires isn't there in the moment of the join so it can't get the tires.id column from anywhere.

ActiveRecord::StatementInvalid (Mysql2::Error: Unknown column 'tires.id' in 'on clause')

If I change the 'eager_load' to 'joins' it solves the issue. However, our app is full of examples like this and I would like to know if there's any other practical solution. Thanks in advance!

System configuration

Rails version: 6.0.0

Ruby version: 2.6.3

@y-yagi
Copy link
Member

y-yagi commented Sep 22, 2019

This issue fixed by #37235. Please wait for a release of the next version. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant