diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-07 16:06:55 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-07 16:06:55 +0400 |
commit | 3dc0bce9474ac52046f5c3efb2532af6334a7aae (patch) | |
tree | 4a3135432072ef8d8d7ed6112d53129ed6614280 /app | |
parent | ab094e67eed54f5c29a33d2114cc91908e543972 (diff) |
Add users to /:id route
So now when you type site/:username it redirects you to users page.
And if you type site/:groupname it redirects you to group page
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/namespaces_controller.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/controllers/namespaces_controller.rb b/app/controllers/namespaces_controller.rb new file mode 100644 index 00000000000..c59a2401cef --- /dev/null +++ b/app/controllers/namespaces_controller.rb @@ -0,0 +1,18 @@ +class NamespacesController < ApplicationController + skip_before_filter :authenticate_user! + + def show + namespace = Namespace.find_by(path: params[:id]) + + unless namespace + return render_404 + end + + if namespace.type == "Group" + redirect_to group_path(namespace) + else + redirect_to user_path(namespace.owner) + end + end +end + |