Commit 7c5320d2c8997208cdc551f53575f99dc163e674

Authored by Dmitriy Zaporozhets
2 parents f84d015f a39eeba1

Merge branch 'snippets-page' into 'master'

Render 404 instead of 500 if trying to see snippets of unexisting user

Fixes #1087
Showing 1 changed file with 3 additions and 0 deletions   Show diff stats
app/controllers/snippets_controller.rb
@@ -19,6 +19,9 @@ class SnippetsController < ApplicationController @@ -19,6 +19,9 @@ class SnippetsController < ApplicationController
19 19
20 def user_index 20 def user_index
21 @user = User.find_by(username: params[:username]) 21 @user = User.find_by(username: params[:username])
  22 +
  23 + render_404 and return unless @user
  24 +
22 @snippets = @user.snippets.fresh.non_expired 25 @snippets = @user.snippets.fresh.non_expired
23 26
24 if @user == current_user 27 if @user == current_user