Skip to content

Instantly share code, notes, and snippets.

@mcob
Created June 9, 2014 18:51
Show Gist options
  • Save mcob/d69172d83d72449243d2 to your computer and use it in GitHub Desktop.
Save mcob/d69172d83d72449243d2 to your computer and use it in GitHub Desktop.
manage_department_families GET /manage/departments/:slug/families(.:format) manage/departments#families
manage_departments GET /manage/departments(.:format) manage/departments#index
POST /manage/departments(.:format) manage/departments#create
new_manage_department GET /manage/departments/new(.:format) manage/departments#new
edit_manage_department GET /manage/departments/:id/edit(.:format) manage/departments#edit
manage_department GET /manage/departments/:id(.:format) manage/departments#show
PATCH /manage/departments/:id(.:format) manage/departments#update
PUT /manage/departments/:id(.:format) manage/departments#update
DELETE /manage/departments/:id(.:format) manage/departments#destroy
# >>>>>> want to still use the 'edit_department_path' and have it locate to '/manage/departments/1/edit
@xionon
Copy link

xionon commented Jun 9, 2014

https://gist.github.com/xionon/bdc2fd0e85013d1a7c9b

made that just as you tweeted back

@xionon
Copy link

xionon commented Jun 9, 2014

Why do you want the URL to be prefixed with /manage, though?

If /departments/:id is the cannonical representation of the department, you probably don't really want the prefix.

If /departments/:id and /manage/departments/:id are different (and both exist in the same system), then you probably want the URL helper to reflect that (and you'll end up with weird conflicts if you don't)

@mcob
Copy link
Author

mcob commented Jun 9, 2014

i see what you are saying. I'm doing it so the url reflects where you are in the app. I'll have to think about it some more. in this case all these controllers are to manage the different objects which then are used in the "users" various controllers.

@xionon
Copy link

xionon commented Jun 9, 2014

Conductor does have a separate /admin namespace, because the view that the CMS admins see is much different from what the browser user sees. In that case, all our route helpers are prefixed with admin_, because "page_path" and "admin_page_path" are semantically different. If the /manage section is similar to an admin, I'd highly suggest you keep the manage_ prefix, because you can't predict if your app will someday need to respond to /departments as well as /manage/departments

@mcob
Copy link
Author

mcob commented Jun 9, 2014

that's what I am doing. The big app I am working on has several namespaces that have manage_ and system_ for the two admin like sections.

This one is small in scope and I was just wanting to be lazy. Already when through and updated all the paths with the prefixes before I even asked a question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment