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

[WIP] Rails71 #23225

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

[WIP] Rails71 #23225

wants to merge 17 commits into from

Conversation

jrafanie
Copy link
Member

@jrafanie jrafanie commented Oct 7, 2024

No description provided.

@jrafanie jrafanie requested a review from Fryguy as a code owner October 7, 2024 22:45
@jrafanie jrafanie changed the title [WIPRails71 [WIP] Rails71 Oct 7, 2024
@jrafanie jrafanie force-pushed the rails71 branch 2 times, most recently from 8888823 to 35c7f80 Compare October 7, 2024 22:53
@jrafanie jrafanie mentioned this pull request Oct 10, 2024
53 tasks
@jrafanie jrafanie force-pushed the rails71 branch 2 times, most recently from 95c915c to 728da06 Compare October 29, 2024 19:37
@jrafanie jrafanie force-pushed the rails71 branch 2 times, most recently from 0eb4c64 to ea2d65d Compare January 7, 2025 23:01
@@ -4,6 +4,7 @@ class MiqSchedule < ApplicationRecord
include Filters

include YamlImportExportMixin
# TODO: towhat is a virtual alias?
Copy link
Member Author

Choose a reason for hiding this comment

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

deprecate_attribute shows up an alias and virtual attribute when I add instrumentation to virtual attributes... This TODO is really "do we have proper tests to know if rails 7.1 did or did not also break these...?"

@jrafanie jrafanie force-pushed the rails71 branch 2 times, most recently from cacf7e3 to 791ae99 Compare February 5, 2025 16:04
@kbrock
Copy link
Member

kbrock commented Feb 5, 2025

@jrafanie I'm thinking we need an alias_association - maybe later we may need to add options for some other cases.

In ManageIQ#23171, we found that we weren't using the legacy connection handlers
and disabled using them in rails 7.0.  Now, in 7.1, this option has been
removed, so it's safe to remove this option entirely.
Rails 7.1 removed the table_name alias to name so just use name:
See: https://www.github.com/rails/rails/pull/46864

Rails 7.1 removed the writer for the table_alias so set the instance
variable. We will need to see if there is a way to do this that's less brittle.
See: https://www.github.com/rails/rails/pull/48927
It's unclear if it fixes all the issues as you can call alias_attribute
anywhere up the ancestry tree and it's possible lazy loading is preventing
them from being loaded.

See:

https://www.github.com/rails/rails/issues/52820
https://www.github.com/rails/rails/pull/52842
(7.1 backport: https://www.github.com/rails/rails/pull/52844)

Looks like it's still an issue in some situations:
https://www.github.com/rails/rails/issues/50154
https://www.github.com/rails/rails/issues/51717
Fixes deprecation of this variety:

Foo model aliases `x`, but `x` is not an attribute. Starting in Rails 7.2, alias_attribute with non-attribute targets will raise. Use `alias_method :y, :x` or define the method manually.
This reverts commit e7acb3235e840aa89d479bf3993a08c53fc13e57.

VERIFY we can drop this revert and the original commit pending due to
https://www.github.com/ManageIQ/activerecord-virtual_attributes/pull/168
This reverts commit e4fa809.

TODO Let's see if this is needed with rails 7.1
Note, rails 7.1 lazily load attribute methods so we can't use alias_method here.
Use runtime method delegation instead of class load time alias_method.

Use single object for singular associations, *args for has manys.

:shrug:
@miq-bot
Copy link
Member

miq-bot commented Feb 6, 2025

Checked commits jrafanie/manageiq@4b6d223~...0b6d445 with ruby 3.1.5, rubocop 1.56.3, haml-lint 0.51.0, and yamllint
27 files checked, 2 offenses detected

Gemfile

  • ❗ - Line 25, Col 3 - Style/CommentAnnotation - Annotation keywords like TODO should be all upper case, followed by a colon, and a space, then a note describing the problem.

app/models/miq_provision.rb

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.

3 participants