From PR: https://github.com/ManageIQ/manageiq/pull/10717 We are using delegates more and more. Found a few bugs with edge cases: 1. When delegating to an association that has a belongs_to, and the foreign key is non-standard, then it got the foreign key wrong. Example: belongs_to :ems_owner, :class_name => 'User' had a foreign key of user_id instead of ems_owner_id. 2. When delegating to a self referring reference, it was not returning records. Example: TestClass.belongs_to :parent, :class_name => "TestClass" 3. Test was accessing postgres due to changes in active record establish_connection. For some reason, this is only an issue when adding a has_one relation. These changes are necessary to add delegation for ems_owner and improve performance of the vms screen.
This BZ has an associated PR #10717 which is within the same context as PR #10704. Refer https://bugzilla.redhat.com/show_bug.cgi?id=1375348#c5 for further context.