Better error when linking to username that doesn't exist
This commit is contained in:
@@ -17,7 +17,11 @@ class UsersController < ApplicationController
|
||||
def index
|
||||
if params[:name].present?
|
||||
@user = User.find_by_name(params[:name])
|
||||
redirect_to user_path(@user)
|
||||
if @user.nil?
|
||||
raise "No user found with name: #{params[:name]}"
|
||||
else
|
||||
redirect_to user_path(@user)
|
||||
end
|
||||
else
|
||||
@users = User.search(params[:search]).order("users.id desc").paginate(params[:page], :limit => params[:limit], :search_count => params[:search])
|
||||
respond_with(@users) do |format|
|
||||
|
||||
Reference in New Issue
Block a user