-
Notifications
You must be signed in to change notification settings - Fork 52
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 7.2+ support #132
base: master
Are you sure you want to change the base?
rails 7.2+ support #132
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,11 @@ class VersionHelper | |
# ::ActiveRecord::VERSION::MAJOR > 7 || | ||
# ::ActiveRecord::VERSION::MAJOR == 7 && ::ActiveRecord::VERSION::MINOR >= 1 | ||
# end | ||
|
||
def self.at_least_7_2? | ||
::ActiveRecord::VERSION::MAJOR == 7 && ::ActiveRecord::VERSION::MINOR >= 2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unclear if this will work on rails 8 at this time There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name of the method suggests that it will apply to Rails 8.0. I believe that the Even if there are issues in Version 8, it would be simpler to start with the Rails 7.2 changes rather than the Rails 7.1 changes. ActiveRecord 8.0.0.rc2 is green with the changes you made. 👍 |
||
end | ||
|
||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,7 @@ def build(relation, buckets) | |
|
||
join_list = join_nodes + joins | ||
|
||
alias_tracker = Associations::AliasTracker.create(relation.klass.connection, relation.table.name, join_list) | ||
alias_tracker = Associations::AliasTracker.create(BabySqueel::ActiveRecord::VersionHelper.at_least_7_2? ? relation.klass.connection.pool : relation.klass.connection, relation.table.name, join_list) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please point to the Documentation why this change is needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the first param for the init method for |
||
join_dependency = Associations::JoinDependency.new(relation.klass, relation.table, association_joins, Arel::Nodes::InnerJoin) | ||
join_dependency.instance_variable_set(:@alias_tracker, alias_tracker) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please add Rails 7.1 and 7.2 to the testmatrix
.github/workflows/build.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kind of a noob on this one - would it need to be
activerecord: ["~> 6.1", "~> 7.2"]
inbuild.yml
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be
activerecord: ["~> 6.1", "~> 7.0" "~> 7.1" "~> 7.2"]
so everything is tested. But I'm not an expert here as well.