-
Notifications
You must be signed in to change notification settings - Fork 26
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
Upgrade to Ruby 2.7.6 #953
Conversation
Incredible. Nothing but net! There are many notices of the upcoming kwarg behavior change in our code to fix, but they're just deprecation warnings for now, and only caused by very few methods. If I can track the methods down, I'll fix them in this PR. |
Excellent news! Yeah, I've slowly been fixing the keyword arguments
whenever I come across them. But I imagine there are still quite a few
left.
I sure hope we can keep acts_as_versioned around. That's a hard one to
switch out. We ran up against that a few years ago, and were very thankful
cure_acts_as_versioned came to the rescue!
…On Fri, May 27, 2022 at 5:22 PM andrew nimmo ***@***.***> wrote:
Incredible. Nothing but net!
There are many notices of the upcoming kwarg behavior change in our code
to fix, but they're just deprecation warnings for now, and only caused by
very few methods. cure_acts_as_versioned needs a tweak too.
If I can track them down, I'll fix them in this PR.
—
Reply to this email directly, view it on GitHub
<#953 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAYTNNNUEII4HFUJWVDSQDTVME4K5ANCNFSM5XFPEI5Q>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I guess you have been fixing them — It's only one method!!! I also think |
In self.version_association_options = {
:class_name => "#{self.to_s}::#{versioned_class_name}",
:foreign_key => versioned_foreign_key,
}.merge(options[:association_options] || {}) and then used here on line 243: included do
has_many :versions, self.version_association_options Should we splat What I don't understand is what the new usage is, for kwargs. I've read a bunch of posts about it and I still don't get it. For the |
I think I've misunderstood something. I'm going to have to look at this
more and get back to you later...
…On Fri, May 27, 2022 at 5:54 PM andrew nimmo ***@***.***> wrote:
In acts_as_versioned.rb, it's here on line 160:
self.version_association_options = {
:class_name => "#{self.to_s}::#{versioned_class_name}",
:foreign_key => versioned_foreign_key,
}.merge(options[:association_options] || {})
What I don't understand is what the new usage is, for kwargs. I've read a
bunch of posts about it and I still don't get it.
For the NameTest#do_name_parse_test(str, expects, deprecated: false) it
seems like I could move the deprecated into the expects, but that's not
very DRY.
—
Reply to this email directly, view it on GitHub
<#953 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAYTNNNHE2NCX7CB5UUWL63VMFABBANCNFSM5XFPEI5Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
So much has been happening, I can't keep up. Re
|
We talked about doing that -- re: using another gem, or the built-in
functionality of recent versions of rails -- in a previous upgrade but it
turned out to be a huge task, so we fell back on the patch. I forgot that
we did it ourselves.
…On Fri, May 27, 2022 at 6:02 PM Joseph D. Cohen ***@***.***> wrote:
So much has been happening, I can't keep up.
I'm glad you've merged everything without waiting for me.
Re cure_acts_as_versioned.
- It is our fork.
- If it's easily fixable, it should be done.
- IMO we should think about moving to a more current, more widely gem,
so that we don't have to maintain it ourselves, even if that means losing
all existing old versions. Example paper_trail
<https://rubygems.org/gems/paper_trail>.
—
Reply to this email directly, view it on GitHub
<#953 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAYTNNKEWF6HQEKWJY7HIODVMFA7PANCNFSM5XFPEI5Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
@JoeCohen - Thanks! I do feel like the
@pellaea - More likely it is I who misunderstood something! But here is a sample of the warnings:
It's basically each time # Parse a string, with detailed error message.
def do_name_parse_test(str, expects, deprecated: false)
...
end
...
def test_name_parse_21
do_name_parse_test(
"Amanita “quoted”",
text_name: 'Amanita "quoted"',
real_text_name: 'Amanita "quoted"',
search_name: 'Amanita "quoted"',
real_search_name: 'Amanita "quoted"',
sort_name: 'Amanita quoted"',
display_name: '**__Amanita "quoted"__**',
parent_name: "Amanita",
rank: :Species,
author: ""
)
end |
What we discovered when we talked about it was that there's no migration
path from acts_as_versioned to paper_trail;
We'd have to start over with the current model versions as the baseline.
I personally think it's worth it in order to reduce issues of gem
incompatibility.
On Fri, May 27, 2022 at 3:14 PM Jason Hollinger ***@***.***>
wrote:
… We talked about doing that -- re: using another gem, or the built-in
functionality of recent versions of rails -- in a previous upgrade but it
turned out to be a huge task, so we fell back on the patch. I forgot that
we did it ourselves.
On Fri, May 27, 2022 at 6:02 PM Joseph D. Cohen ***@***.***>
wrote:
> So much has been happening, I can't keep up.
> I'm glad you've merged everything without waiting for me.
>
> Re cure_acts_as_versioned.
>
> - It is our fork.
> - If it's easily fixable, it should be done.
> - IMO we should think about moving to a more current, more widely gem,
> so that we don't have to maintain it ourselves, even if that means losing
> all existing old versions. Example paper_trail
> <https://rubygems.org/gems/paper_trail>.
>
> —
> Reply to this email directly, view it on GitHub
> <
#953 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AAYTNNKEWF6HQEKWJY7HIODVMFA7PANCNFSM5XFPEI5Q
>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>
—
Reply to this email directly, view it on GitHub
<#953 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAALDFCVBWVTBOX5HUYCWLLVMFCOBANCNFSM5XFPEI5Q>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
This works!
I solved the NameTest kwarg issue with a small refactor.
… On May 27, 2022, at 4:19 PM, codeclimate[bot] ***@***.***> wrote:
Code Climate has analyzed commit e553f05 and detected 0 issues on this pull request.
View more on Code Climate.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
Will put that NameTest refactor in a separate PR off master tonight. But for the time being, it helps in checking out this PR.
Note that :
a) this PR bundles Rails 6.1, since it's assuming that PR would get merged first.
b) it is easy to switch Ruby version back to 2.6.6 after trying this. just `rvm use 2.6.6` - both versions will still be installed on your vagrant box, and 2.6.6 remains the default.
… On May 27, 2022, at 4:19 PM, codeclimate[bot] ***@***.***> wrote:
Code Climate has analyzed commit e553f05 and detected 0 issues on this pull request.
View more on Code Climate.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
@nimmolo. Re has_many :versions, self.version_association_options
self.version_association_options = {
:class_name => "#{self.to_s}::#{versioned_class_name}",
:foreign_key => versioned_foreign_key,
}.merge(options[:association_options] || {}) So the call to # File activerecord/lib/active_record/associations.rb, line 1370
def has_many(name, scope = nil, **options, &extension) I don't know what to try. Maybe add a second positional arg: has_many :versions, nil, self.version_association_options Maybe try an extra splat has_many :versions, **(self.version_association_options) Even worse, I have no idea how to try out these ideas. I forget how I worked with |
Joe - I'm going to try the extra splat (forking the repo and telling Gemfile to load my local version). Will report back!
… On May 27, 2022, at 5:45 PM, Joseph D. Cohen ***@***.***> wrote:
@nimmolo. Re acts_as_versioned
I'm also not getting it.
act_as_versioned line 243:
has_many :versions, self.version_association_options
self.version_association_options is a hash
act_as_versioned lines 160-163:
self.version_association_options = {
:class_name => "#{self.to_s}::#{versioned_class_name}",
:foreign_key => versioned_foreign_key,
}.merge(options[:association_options] || {})
So the call to has_many does use a hash as its last argument.
But has_many ought to handle that, as it splats the options param:
# File activerecord/lib/active_record/associations.rb, line 1370
def has_many(name, scope = nil, **options, &extension)
I don't know what to try. Maybe add a second positional arg:
has_many :versions, nil, self.version_association_options
Maybe try an extra splat
has_many :versions, **(self.version_association_options)
Even worse, I have no idea how to try out these ideas. I forget how I worked with acts_as_versioned when I forked it.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
Hi Joe -
It’s not necessary for my local test, but in case it works...
Could you grant me commit privileges to MO’s “acts_as_versioned”?
I seem to have write access to many of the repos, but not this one.
nimmo
…On May 27, 2022, 10:19 PM -0700, nimmo ***@***.***>, wrote:
Joe - I'm going to try the extra splat (forking the repo and telling Gemfile to load my local version). Will report back!
On May 27, 2022, at 5:45 PM, Joseph D. Cohen ***@***.***> wrote:
> @nimmolo. Re acts_as_versioned
> I'm also not getting it.
> act_as_versioned line 243:
> has_many :versions, self.version_association_options
> self.version_association_options is a hash
> act_as_versioned lines 160-163:
> self.version_association_options = {
> :class_name => "#{self.to_s}::#{versioned_class_name}",
> :foreign_key => versioned_foreign_key,
> }.merge(options[:association_options] || {})
> So the call to has_many does use a hash as its last argument.
> But has_many ought to handle that, as it splats the options param:
> # File activerecord/lib/active_record/associations.rb, line 1370
> def has_many(name, scope = nil, **options, &extension)
> I don't know what to try. Maybe add a second positional arg:
> has_many :versions, nil, self.version_association_options
> Maybe try an extra splat
> has_many :versions, **(self.version_association_options)
> Even worse, I have no idea how to try out these ideas. I forget how I worked with acts_as_versioned when I forked it.
> —
> Reply to this email directly, view it on GitHub, or unsubscribe.
> You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Fixes "last argument as keyword parameters is deprecated" as kwargs by double-splatting the last argument. See https://www.ruby-lang.org/en/news/2019/12/25/ruby-2-7-0-released/ MushroomObserver/mushroom-observer#953 (comment)
I believe this is good to go:
|
Actually, #957 should merge first. But then the dep warnings will be fixed. |
Code Climate has analyzed commit 008ebfa and detected 0 issues on this pull request. View more on Code Climate. |
Good to merge if you're ready. Rubocop says 👍, Codeclimate says🤙 |
I woke up thinking about this problem.
1. You now have full access (Admin) to that repo.
2. Simply splatting the arg works for me:
has_many :versions, **self.version_association_options
(I edited acts_as_versioned.rb on my vm.)
So you can simply edit that file in the repo. And also update CHANGELOG.
Or I can do both in the morning. (I'm going back to bed.)
-- Joe
On Sat, May 28, 2022 at 2:22 AM andrew nimmo ***@***.***>
wrote:
… Hi Joe -
It’s not necessary for my local test, but in case it works...
Could you grant me commit privileges to MO’s “acts_as_versioned”?
I seem to have write access to many of the repos, but not this one.
nimmo
On May 27, 2022, 10:19 PM -0700, nimmo ***@***.***>, wrote:
> Joe - I'm going to try the extra splat (forking the repo and telling
Gemfile to load my local version). Will report back!
>
> On May 27, 2022, at 5:45 PM, Joseph D. Cohen ***@***.***> wrote:
>
> > @nimmolo. Re acts_as_versioned
> > I'm also not getting it.
> > act_as_versioned line 243:
> > has_many :versions, self.version_association_options
> > self.version_association_options is a hash
> > act_as_versioned lines 160-163:
> > self.version_association_options = {
> > :class_name => "#{self.to_s}::#{versioned_class_name}",
> > :foreign_key => versioned_foreign_key,
> > }.merge(options[:association_options] || {})
> > So the call to has_many does use a hash as its last argument.
> > But has_many ought to handle that, as it splats the options param:
> > # File activerecord/lib/active_record/associations.rb, line 1370
> > def has_many(name, scope = nil, **options, &extension)
> > I don't know what to try. Maybe add a second positional arg:
> > has_many :versions, nil, self.version_association_options
> > Maybe try an extra splat
> > has_many :versions, **(self.version_association_options)
> > Even worse, I have no idea how to try out these ideas. I forget how I
worked with acts_as_versioned when I forked it.
> > —
> > Reply to this email directly, view it on GitHub, or unsubscribe.
> > You are receiving this because you were mentioned.Message ID:
***@***.***>
—
Reply to this email directly, view it on GitHub
<#953 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAALDFHF7YUGTJ26WFU4FGLVMHQWLANCNFSM5XFPEI5Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Steps to try the update, a couple safeguards to prevent a glitch updating the gem
mini-racer
to0.6.2
.These can be performed in vagrant console:
Add the new Ruby version alongside 2.6.6
rvm install 2.7.6
/bin/bash --login
rvm use 2.7.6
ruby -v
(check!)Update rubygems and bundler
gem update --system
gem update bundler
Delete your gemfile.lock and update the gems
bundle update