the 404 page is shown again if an user was not found

This commit is contained in:
nilsding 2014-12-21 15:32:49 +01:00
parent 36f069d958
commit 0ddb1a609c
1 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
class UserController < ApplicationController class UserController < ApplicationController
def show def show
@user = User.where('LOWER(screen_name) = ?', params[:username].downcase).first @user = User.where('LOWER(screen_name) = ?', params[:username].downcase).first!
@answers = @user.answers.reverse_order.paginate(page: params[:page]) @answers = @user.answers.reverse_order.paginate(page: params[:page])
respond_to do |format| respond_to do |format|
format.html format.html
@ -23,7 +23,7 @@ class UserController < ApplicationController
def followers def followers
@title = 'Followers' @title = 'Followers'
@user = User.where('LOWER(screen_name) = ?', params[:username].downcase).first @user = User.where('LOWER(screen_name) = ?', params[:username].downcase).first!
@users = @user.followers.reverse_order.paginate(page: params[:page]) @users = @user.followers.reverse_order.paginate(page: params[:page])
@type = :friend @type = :friend
render 'show_follow' render 'show_follow'
@ -31,7 +31,7 @@ class UserController < ApplicationController
def friends def friends
@title = 'Following' @title = 'Following'
@user = User.where('LOWER(screen_name) = ?', params[:username].downcase).first @user = User.where('LOWER(screen_name) = ?', params[:username].downcase).first!
@users = @user.friends.reverse_order.paginate(page: params[:page]) @users = @user.friends.reverse_order.paginate(page: params[:page])
@type = :friend @type = :friend
render 'show_follow' render 'show_follow'
@ -39,7 +39,7 @@ class UserController < ApplicationController
def questions def questions
@title = 'Questions' @title = 'Questions'
@user = User.where('LOWER(screen_name) = ?', params[:username].downcase).first @user = User.where('LOWER(screen_name) = ?', params[:username].downcase).first!
@questions = @user.questions.where(author_is_anonymous: false).reverse_order.paginate(page: params[:page]) @questions = @user.questions.where(author_is_anonymous: false).reverse_order.paginate(page: params[:page])
end end
end end