Reputation: 4467
I have set this resource route in my Routes.rb
namespace :admin do
resources :posts
end
How can I rename the route name and path name specifically for index
, which at the moment is
# route
admin_posts GET /admin/posts(.:format) admin/posts#index
# path
admin_posts_path
rename to
dashboard_path
Upvotes: 0
Views: 1091
Reputation: 33420
After your namespace definition in the routes.rb file, you can create a new "entry" for such controller and action, like:
namespace :admin do
resources :posts
end
get 'dashboard', to: 'admin/posts#index', as: :dashboard
Upvotes: 2
Reputation: 298
Try this:
resources :posts, except: [:index]
get 'your_url', to: 'controller@action', as: 'dashboard_path'
There is no support for renaming inside resources.
Upvotes: 1