Bug 1375195 - VirtualDelegate: Fix foreign key for belongs_to
Summary: VirtualDelegate: Fix foreign key for belongs_to
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Performance
Version: 5.7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: GA
: 5.7.0
Assignee: Keenan Brock
QA Contact: Pradeep Kumar Surisetty
URL:
Whiteboard:
Depends On:
Blocks: 1375206
TreeView+ depends on / blocked
 
Reported: 2016-09-12 13:14 UTC by Satoe Imaishi
Modified: 2019-08-06 20:04 UTC (History)
5 users (show)

Fixed In Version: 5.7.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1375206 (view as bug list)
Environment:
Last Closed: 2016-12-21 11:48:11 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Satoe Imaishi 2016-09-12 13:14:36 UTC
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.

Comment 4 Archit Sharma 2016-12-21 11:41:34 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.