Commit ca5c762c authored by Michael Kozono's avatar Michael Kozono

Refactor

parent 72872ee2
......@@ -94,11 +94,9 @@ class UsersController < ApplicationController
private
def authorize_read_user!
if can?(current_user, :read_user, user)
ensure_canonical_path(user.namespace, params[:username])
else
render_404
end
render_404 unless can?(current_user, :read_user, user)
ensure_canonical_path(user.namespace, params[:username])
end
def user
......
......@@ -43,11 +43,13 @@ class Route < ActiveRecord::Base
RedirectRoute.matching_path_and_descendants(path)
end
def create_redirect_for_old_path
create_redirect(path_was) if path_changed?
end
def create_redirect(path)
RedirectRoute.create(source: source, path: path)
end
private
def create_redirect_for_old_path
create_redirect(path_was) if path_changed?
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment