Skip to content

Conversation

@Fryguy
Copy link
Member

@Fryguy Fryguy commented Oct 8, 2025

This flips ActsAsArModel to be search-first (i.e. via QueryRelation) and deprecates the old-style find method that takes :all, :first, or :last (However, find with an id is still supported just like in Rails). This also deprecates the old-style find_by_id and find_all_by_id.

WIP: I think I should change the default implementation of PglogicalSubscription#search to handle where :id - right now it can't handle it.

cc @kbrock

end

singleton_class.send(:alias_method, :find_by_id, :lookup_by_id)
Vmdb::Deprecation.deprecate_methods(singleton_class, :find_by_id => :lookup_by_id)
Copy link
Member Author

Choose a reason for hiding this comment

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

This deprecation was moved into the base class.

@Fryguy Fryguy force-pushed the aarm_is_query_relation branch from df9c3b9 to 084b6ec Compare October 8, 2025 21:26
@Fryguy Fryguy force-pushed the aarm_is_query_relation branch from 084b6ec to 1471303 Compare October 8, 2025 22:32
@Fryguy
Copy link
Member Author

Fryguy commented Oct 9, 2025

Interestingly no deprecations showed up in the tests...let's see what cross repo shows

@miq-bot cross-repo-test /all

miq-bot pushed a commit to ManageIQ/manageiq-cross_repo-tests that referenced this pull request Oct 9, 2025
Comment on lines -161 to 176
def self.to_legacy_options(options)
def self.from_legacy_options(options)
{
:conditions => options[:where],
:include => options[:includes],
:limit => options[:limit],
:order => options[:order],
:offset => options[:offset],
:select => options[:select],
:group => options[:group],
:where => options[:conditions],
:includes => options[:include],
:limit => options[:limit],
:order => options[:order],
:offset => options[:offset],
:select => options[:select],
:group => options[:group],
}.delete_blanks
Copy link
Member

Choose a reason for hiding this comment

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

yea, think we can drop support for find(:all).

We have no callers and only class implements this interface

Copy link
Member

@kbrock kbrock left a comment

Choose a reason for hiding this comment

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

Think we can be more yolo here.

The interface for QueryRelation is search. We decided to convert that to legacy find, for all of our AAArM implementations, but since PglogicalSubscription is the only class that implemented find(), lets just fix it in the one place and not keep around the legacy find support and all.

I am a little concerned that Chargebacks and VimPerformanceTrends do not properly implement the AAArM interface, but it looks like reports call a custom method to run those reports. (i.e.: trend.rb )

Don't feel we should keep dead weight in our interface when we don't have anything using that interface (except for pglogical)

@Fryguy
Copy link
Member Author

Fryguy commented Oct 9, 2025

Yeah I was concerned maybe something was using that old interface that's why I added the deprecations but nothing showing up as deprecations so I don't think it's used

@kbrock
Copy link
Member

kbrock commented Oct 9, 2025

Just a grep across the org for 'self.find\b' really speaks for itself.
(and then doing the same for search - which is also basically nada)

possibly interesting

def self.find(*args) manageiq:pglogical_subscription.rb:19
def self.find(*_args) manageiq:acts_as_ar_model.rb:149
def self.search(mode, options = {}) manageiq:acts_as_ar_model.rb:156
def find(*args) manageiq-api-client:collection.rb:35
def search(mode, options) manageiq-api-client:collection.rb:80

not interesting

def self.search(str) manageiq:miq_ae_instance.rb:80
def self.search(*args) manageiq:filterer.rb:176
def search(options = {}) manageiq:filterer.rb:226
def self.search(*args) manageiq:rbac.rb:2
def search(opts, &blk) manageiq:miq_ldap.rb:155
def search(object_ref = nil, options = {}) manageiq-automation_engine:miq_ae_browser.rb:43
def find(id) manageiq-automation_engine:miq_ae_service_front.rb:9
def self.find(id) manageiq-automation_engine:miq_ae_service.rb:21
def search(uri, namespace, klass, instance, method) manageiq-automation_engine:miq_ae_domain_search.rb:26
def find(collection, lookup_pairs) manageiq-providers-openstack:interaction_methods.rb:25
def find(obj) manageiq-providers-vmware:cache.rb:25
def find(dir, depth = nil, level = 0) manageiq-smartstate:MiqFS.rb:241
def find(name) manageiq-smartstate:attrib_index_root.rb:108
def self.find(path, max_depth = nil) manageiq-smartstate:find_class_methods.rb:51

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