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:
Dmitriy Zaporozhets 2014-03-14 15:55:41 +02:00
parent 17a9ecf8cf
commit a39eeba1dc
No known key found for this signature in database
GPG key ID: 627C5F589F467F17

View file

@ -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