Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I rename a resource in routes.rb?

In routes.rb, I currently have resources :users for the User controller.

A visitor can request the User model by www.mydomain.com/users

I would like to keep the User controller as it is, but have the URL request for people instead, such that a visitor sees the following URL: www.mydomain.com/people

For a single request I can do this by:

get '/users', to: 'users#index'

Is the same possible for for a resource map?

like image 727
Fellow Stranger Avatar asked Apr 02 '14 07:04

Fellow Stranger


1 Answers

You can use path option of resources method:

resources :users, path: :people
like image 144
Marek Lipka Avatar answered Oct 08 '22 01:10

Marek Lipka