-
Notifications
You must be signed in to change notification settings - Fork 0
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
UserLoans#update | PATCH api/v1/users/:id/loans/:id
#51
Conversation
def update | ||
user = User.find(params[:id]) | ||
loans = Loan.where(owner_id: user.id).or(Loan.where(borrower_id: user.id)) | ||
loan_id = loans.find(params[:loan_id]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable name should change from loan_id
to loan
since it is a loan object and not just an id number
|
||
def update | ||
user = User.find(params[:id]) | ||
loans = Loan.where(owner_id: user.id).or(Loan.where(borrower_id: user.id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this logic is not needed since we have the loan_id being passed through params:
loan = Loan.find(params[:id])
|
||
if params[:action_type] == 'deny' || params[:action_type] == 'withdraw' | ||
if loan_id.update(status: 2) | ||
dashboard_info = user.find_dashboard_info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good logic here to try and update dashboard but not necessary, can be deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Please see my comment
api/v1/users/:id/loans/:id
Changes:
This is related to #33
This closes #33
[x] I linted my work. (RuboCop)
[] I've updated documentation & README. (if necessary)
(For Fun!) Please include a link to a meme/gif of your feelings about this branch!
Link: