Refactor Requests controller#5563
Open
stefannibrasil wants to merge 7 commits into
Open
Conversation
Moving view instances to a View Object.
This was raising a bullet error: GET /donations AVOID eager loading detected Donation => [:product_drive_participant] Remove from your query: .includes([:product_drive_participant])
Moving view instances to a View Object to keep the controller clean. Add coverage for business logic
add coverage for Request model view
d3dc2a5 to
1f08698
Compare
stefannibrasil
commented
May 11, 2026
| @@ -31,7 +31,6 @@ def from_params(params:, organization:, helpers:) | |||
| .includes(:storage_location, | |||
| :donation_site, | |||
| :product_drive, | |||
Contributor
Author
There was a problem hiding this comment.
I am happy to remove this change from this PR. I got here by looking at other view objects and saw the bullet's warning: 8089be6cb25bfff90506e634fc486dbaf6454e9b
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #5557
Description
In #5543, I added one more variable to this controller. I didn't want to refactor the controller since the PR was already too big and it's a good practice to refactor in a separate stream of work.
This PR moves instance variables used in the views to View objects. This keeps the controller slim and it's more maintainable to add methods to the view objects from now on.
Type of change
How Has This Been Tested?
Screenshots
Short walk trough of requests page:
requests.refactor.480.mov