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

Rails 8.0 #113

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Rails 8.0 #113

wants to merge 5 commits into from

Conversation

GeorgeKaraszi
Copy link
Owner

No description provided.

union_values: Array,
union_operations: Array,
union_ordering_values: Array,
unionized_name: lambda { |klass| klass.arel_table.name }
Copy link

Choose a reason for hiding this comment

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

Thanks for fixing this! this is an issue on rails 7.1 and 7.2 as well.

There is still a reference to @klass.arel_table on line 147 :

def build_unions(arel = @klass.arel_table)

union_values: DEFAULT_STORAGE_VALUE,
union_operations: DEFAULT_STORAGE_VALUE,
union_ordering_values: DEFAULT_STORAGE_VALUE,
unionized_name: proc { @table.name }
Copy link

Choose a reason for hiding this comment

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

I did a simpler fix here which i think is better rather than relyin on an instance variable @table which can change overtime ( like @klass did )
chaadow@959c1e3

i think arel_table is more stable than @table or @klass because it's a very historic method, and is I belive more stable and can endure rails upgrades overtime, increasing the longevity of this gem 👍🏼

@@ -141,7 +144,7 @@ def to_nice_union_sql(color = true)

protected

def build_unions(arel = @klass.arel_table)
def build_unions(arel = @table)
Copy link

Choose a reason for hiding this comment

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

this method is only called once in the entire gem, i ve tried this default (basically calling build_unions without any arguments) and unfortunately it didnt work.

So maybe just remove the default value altogether?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I cannot remember, but I had a valid reason for it at one point (years ago). I'll strip it since it should, in most cases, only be called with a provided arel reference.

@GeorgeKaraszi
Copy link
Owner Author

Something that we'll need to figure out is how to deal with the following deprecations:

  • CTE (with)
    • The Rails team has contributed very well to implementing this API, and overriding it with this gem makes no sense.
  • foster_select
    • With the new select features that allow for column aliases, this doesn't serve any purpose.

@modosc
Copy link

modosc commented Dec 2, 2024

hi - i have some cycles and would be happy to help finish this pr (this blocks my workplace from upgrading to rails 8).

Something that we'll need to figure out is how to deal with the following deprecations:

  • CTE (with)
    • The Rails team has contributed very well to implementing this API, and overriding it with this gem makes no sense.

if i'm understanding correctly, is the ask here just to skip autoload :WithCTE when AR_VERSION_GTE_8_0 is true? or are there any backwards compat issues?

  • foster_select
    • With the new select features that allow for column aliases, this doesn't serve any purpose.

would it be reasonable to just deprecate this method and aim to remove it in the next major version bump?

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

Successfully merging this pull request may close these issues.

3 participants