user url
myKingEdem opened this issue · 1 comments
myKingEdem commented
ther url for user 1 is localhost:3000/users/1....this is tempting to type in say 2, and it will take you to that page, which is good.
But type in 0, or a number above the number of users in the database and you get and ActiveRecord::RecordNotFound error.
How do you redirect to a different page, preferably the users_index_page.
elCorsaiR commented
def show
@user = User.find(params[:id])
rescue ActiveRecord::RecordNotFound
flash[:notice] = "User not found"
redirect_to :action => 'index'
end