I'm pretty new to Ruby on Rails. I have a relatively straightforward question: Should exceptions raised due to missing params be rescued?
For example, imagine the following code in a FriendRequestsController:
@request = FriendRequest.find(params[:id])
flash[:notice] = "Friend request updated successfully."
flash[:errors] = @request.errors.full_messages
In short the answer is no. When you call
def friend_request_params params.require(:friend_request).permit(:status) end
You have established a contract with any action that uses the friend_request_params. If that action calls friend_request_params and doesn't send a :friend_request, the action has violated the contract and an exception should be raised. Your application is legitimately not working as designed and the exception is your canary in the coal mine so to speak.