How can I change params inside controller?
When I click the accept it will pass the status is approved but if diff <= 0 change status to rejected
View
<%= link_to 'Accept', friend_path(s, :request => {:status => 'Accepted'}), method: :put %>
into this
if diff <= 0
req_params[:status] = "Rejected"
@request.update(req_params)
end
end
private
def req_params
params.require(:request).permit(:status)
end
end
req_paramsis params filtered by strong params? (require,permit)button_toor a regular form and notlink_toand pass the parameters in the request body instead of the URL. Usinglink_towithmethod:option should only be really be done when the request has no params likelink_to "Delete", thing, method: :deletediffvariable? Can you please post all your controller action code? (I think it'supdatemethod)startandendvariables? (I'am asking all of this, because I want to suggest you some really good solution in case of design)