diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index cac19ea..ef56d8f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -182,7 +182,9 @@ class UsersController < ApplicationController require_login || return @user = User.current else - @user = User.find(params[:id]) + if Integer(params[:id]) + @user = User.find(params[:id]) + end rescue @user = User.where(login: params[:id]).first end rescue ActiveRecord::RecordNotFound render_404 diff --git a/config/routes.rb b/config/routes.rb index 4533c3c..f959c4d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -88,6 +88,7 @@ Rails.application.routes.draw do resources :memberships, :controller => 'principal_memberships' resources :email_addresses, :only => [:index, :create, :update, :destroy] end + get '/u/:id', :to => 'users#show' post 'watchers/watch', :to => 'watchers#watch', :as => 'watch' delete 'watchers/watch', :to => 'watchers#unwatch'