Improve routing. Project access via namespace
This commit is contained in:
parent
a4d1bc1791
commit
26622f4c8f
4 changed files with 21 additions and 8 deletions
|
@ -63,7 +63,10 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def project
|
||||
@project ||= current_user.projects.find_by_code(params[:project_id] || params[:id])
|
||||
id = params[:project_id] || params[:id]
|
||||
id = id.split("/") if id.include?("/")
|
||||
|
||||
@project ||= current_user.projects.find_by_code(id)
|
||||
@project || render_404
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue