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

[WIP] Rails 7.1 support #168

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

[WIP] Rails 7.1 support #168

wants to merge 2 commits into from

Conversation

jrafanie
Copy link
Member

@jrafanie jrafanie commented Oct 7, 2024

Rails 7.1 removed the table_name alias to name so just use name:
See: https://www.github.com/rails/rails/pull/46864

Rails 7.1 removed the writer for the table_alias so set the instance
variable. We will need to see if there is a way to do this that's less brittle.
See: https://www.github.com/rails/rails/pull/48927
@jrafanie jrafanie added wip Work in progress rails7.1 enhancement New feature or request labels Oct 7, 2024
# use a dup to not modify the primary table in the model
to_table = to_table.dup
# use a table alias to not conflict with table name in the primary query
to_table.table_alias = "#{to_table.table_name}_sub"
to_table.instance_variable_set(:@table_alias, "#{to_table.name}_sub")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kbrock do we need to set a table alias in this way? I didn't look to see if this was yours or Nick's comment. Clearly, they don't want to let us set it so I concerned this will change in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aah - now I remember

rails uses a manager to manage the names of the tables (so you can do a self join and it all works)

I had been meaning to change this for the next revision

If I remember correctly, this is tied to 3 test failures - the only real failures for rails.

They are real faiulres.
Pretty sure we don't want name here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave this WIP... feel free to take this change in part or whole and change it while I'm away.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm putting together a PR for tests that will verify this change

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kbrock do you have suggestions on getting this change in? I'm not a fan of this change so I'm open to something better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request rails7.1 wip Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants