Render 404 instead of 500 if trying to see snippets of unexisting user
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
parent
17a9ecf8cf
commit
a39eeba1dc
1 changed files with 3 additions and 0 deletions
|
@ -19,6 +19,9 @@ class SnippetsController < ApplicationController
|
|||
|
||||
def user_index
|
||||
@user = User.find_by(username: params[:username])
|
||||
|
||||
render_404 and return unless @user
|
||||
|
||||
@snippets = @user.snippets.fresh.non_expired
|
||||
|
||||
if @user == current_user
|
||||
|
|
Loading…
Reference in a new issue