-
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
Rails 7 mvp (just get it runnable with rails 7) #146
Conversation
klass.instance_method(instance_method) | ||
rescue NameError => err | ||
msg = "#{klass} is missing the method our prepended code is expecting to patch. Was the undefined method removed or renamed upstream?\nSee: #{__FILE__}.\nThe NameError was: #{err}. " | ||
raise NameError, msg |
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.
Wording is hard. Here's what it looks like when I run the tests with a bogus xxx
method added to the list of methods we expect to be there:
NameError:
ActiveRecord::Associations::Preloader is missing the method our prepended code is expecting to patch. Was the undefined method removed or renamed upstream?
See: /Users/joerafaniello/Code/activerecord-virtual_attributes/lib/active_record/virtual_attributes/virtual_fields.rb.
The NameError was: undefined method `xxx' for class `ActiveRecord::Associations::Preloader'
klass.instance_method(instance_method)
^^^^^^^^^^^^^^^^.
raise NameError, msg
^^^^^
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 will have to bump the minor version for this anyway with adding rails 7 support but since we're already dropping 6.0 and older, we can include this and just bump the major version.
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.
remember, this is not semver, we need to follow versions that signify this is good for rails 7.0.x - so we'll be using 7.0.y (y is not x, x is theirs, y is ours)
@miq-bot cross-repo-tests /all |
From Pull Request: ManageIQ/activerecord-virtual_attributes#146
Cross repo is green for this on rails 6.1. I'm continuing to look at rails 7 failures in cross repo plus this branch but they may be unrelated to this branch. Getting this merged into master will help. We can release a tag when I confirm there are no other rails 7 fixes needed. |
@kbrock this is ready for review/merge. Thanks! |
b375aa9
to
bb51ec9
Compare
I fixed most of the cops, leaving the remaining as that is how it was coming from rails with our minor changes. |
Checked commits jrafanie/activerecord-virtual_attributes@9885686~...f8b0bc7 with ruby 3.1.5, rubocop 1.56.3, haml-lint 0.51.0, and yamllint lib/active_record/virtual_attributes/virtual_fields.rb
|
Ok, I've addressed the comments, most of the cops and cross repo is green on Rails 6.1. |
@Fryguy this is ready for review/merge |
This is ready for review/merge. Thanks! |
@kbrock what are your thoughts on merging/releasing this one? |
I admit I'm a little hesitant on deleting the calculate. But LGTM UPDATE: those virtual total tests are very pedantic. Feeling much more comfortable after reading through those again. Feels like it would be very tricky for anything to sneak by |
These were extracted from #133
Additionally, I added warnings if the expected class is missing instance methods for the different versions of rails. That way, if we try to prepend methods in future versions, we'll know if they were renamed or removed.
💚 Cross repo