-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add rails 7.0 support and drop rails 6.1 #150
Conversation
} | ||
loaders | ||
# preloader is called with virtual attributes - need to resolve | ||
def call |
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.
EDIT: where is call
being called originally? What's the entrypoint?
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.
Great question.
Sure, we do explicitly call it in our specs: https://github.com/kbrock/activerecord-virtual_attributes/blob/allow_rails_7/spec/virtual_includes_spec.rb#L542
But most of the time, it is called directly by rails.
From what I can tell, this is mostly called directly from preload_associations via exec_query.
I did try patching in that caller, but when we ran the preloader directly, this had issues - as you know since you had to skip those 3 tests before (we were since able to unskip).
So this fixes 18 specs (probably 50+ uses) in virtual_includes_specs like:
expect(Author.includes(:nick_or_name)).to preload_values(:nick_or_name, author_name)
This includes
value ends up in a Preloader. As you know, it is not valid. So we need to translate from the old includes values to the proper ones.
Now I did try and just update @associations
value directly, but that only worked if there were no additional levels, so many tests were still failing.
This fix called allows us to get more complicated with our associations.
Coincidently, this recursive-ish solution is similar to the v6 changes where we call into self if the value changed. That was purely coincidental but brought me comfort.
My bad. I don't know why but I didn't think it made it into #146, but it did. Sorry. |
@jrafanie good catch. We can definitely deleted them. I thought I had. update: where are you seeing them? We are only patching the following methods (and
|
2fd0bb9
to
5d322ef
Compare
update:
update:
|
Sorry, it landed in #146, I forgot I was able to get that moved to the mvp PR |
ManageIQ/manageiq#22873 is updated to use this branch for rails 7.0 support, and cross repo is being run against it: ManageIQ/manageiq-cross_repo-tests#871. It's 💚 other than consumption but I'll take a look at that. It's not a new problem. It has been failing but because it always fails, I've looked at the other failures first.
|
@kbrock I think we're good to go on moving this forward. I think the test failure in consumption is unrelated to virtual attributes. Looking at this PR one more time. |
update (lj):
update:
(not sure if the preloader change was from here or a previous push) |
This has changelog in it. |
See rails commit: e3b9779cb701c63012bc1af007c71dc5a888d35a
remove extra gook from grouped_records the "Fix includes" commit resolves any other issues that were handled in here
The preloading components moved into Branch It also brought a bunch of variables into class level and put resolution into instances So our approach of returning a hash and resolving accordingly no longer worked. Since association was stored in the class, we needed to derive the values multiple times
Some comments on commits kbrock/activerecord-virtual_attributes@0595547~...2905c1c spec/spec_helper.rb
|
Checked commits kbrock/activerecord-virtual_attributes@0595547~...2905c1c with ruby 3.1.5, rubocop 1.56.3, haml-lint 0.51.0, and yamllint lib/active_record/virtual_attributes/virtual_fields.rb
|
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.
We did a cross repo on this branch and it all passed 💚
Fixed includes and select issues
we're good to go for rails 7.0 with this