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

Fixes #37825 - Upgrade Rails to 7.0 #10299

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

ofedoren
Copy link
Member

Based on #10131, but with additional commit needed for Rails upgrade.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

In #9328 I also updated spring. Is that not needed? I recall running into it, but that could have been a Ruby thing or I was just looking at changelogs.

@@ -5,7 +5,7 @@ module Token
included do
has_one :token, :foreign_key => :host_id, :dependent => :destroy, :inverse_of => :host, :class_name => 'Token::Build'

scope :for_token, ->(token) { joins(:token).where(:tokens => { :value => token }).where("expires >= ?", Time.now.utc.to_s(:db)).select('hosts.*') }
scope :for_token, ->(token) { joins(:token).where(:tokens => { :value => token }).where("expires >= ?", Time.now.utc.to_fs(:db)).select('hosts.*') }
Copy link
Member

Choose a reason for hiding this comment

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

TIL: there's .to_fs in Rails. I wonder if Rails is smart enough to understand

Suggested change
scope :for_token, ->(token) { joins(:token).where(:tokens => { :value => token }).where("expires >= ?", Time.now.utc.to_fs(:db)).select('hosts.*') }
scope :for_token, ->(token) { joins(:token).where(:tokens => { :value => token }).where("expires >= ?", Time.now.utc).select('hosts.*') }

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Have you tried if moving the settings into initializers works with Rails 6.1?

Comment on lines 94 to +95
class ::FakePlugin; end
class ::FakePlugin::FakeModel; end
class ::FakePlugin::FakeModel < ApplicationRecord; end
Copy link
Member

Choose a reason for hiding this comment

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

Should this even be

module FakePlugin
  class FakeModel < ApplicationRecord
  end
end

@ofedoren ofedoren changed the title Rails 7.0 Fixes #37825 - Upgrade Rails to 7.0 Sep 16, 2024
@ofedoren ofedoren marked this pull request as ready for review September 16, 2024 15:02
@ofedoren ofedoren requested a review from a team as a code owner September 16, 2024 15:02
@ekohl ekohl mentioned this pull request Sep 17, 2024
@ofedoren
Copy link
Member Author

There left only one test failure, I'm looking into it, for now I've got no clue :/

Apart from that, it's ready unless we want to be more correct and apply/incorporate these changes: https://railsdiff.org/6.1.7.8/7.0.8.4

@ofedoren
Copy link
Member Author

Now it fails due to ldap_fluff, since it's locked on active_support < 7 (https://github.com/theforeman/ldap_fluff/blob/master/ldap_fluff.gemspec#L21). Weird that it didn't fail before...

Also, @ekohl and @adamruzicka or maybe @ShimShtein, since you have more experience with the codebase and Rails, could you please help me get why the test fails? I'll be out for the next week (30.09 - 06.10), so I hope we won't waste that week.

Regarding the test: I think it's due to code reloading happening somewhere in the test:units suit since running each of test/models, test/helpers and test/unit separately works, it works even if run rails test test/models test/helpers test/unit, which is the same what rake test:units does. Setting test_order = :sorted doesn't help. Also, I've noticed that for some reason it can pass twice in a row, but another run would fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants