-
Notifications
You must be signed in to change notification settings - Fork 975
Expand file tree
/
Copy pathroutes.rb
More file actions
37 lines (26 loc) · 895 Bytes
/
routes.rb
File metadata and controls
37 lines (26 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Rails.application.routes.draw do
resources :authors, only: %i[show index] do
resources :posts, only: %i[show index new edit]
end
resources :posts, only: %i[index show new create edit update]
# get '/admin/stats', to: 'stats#index'
#
# get '/admin/authors/new', to: 'authors#new'
# get '/admin/authors/delete', to: 'authors#delete'
# get '/admin/authors/create', to: 'authors#create'
# get '/admin/comments/moderate', to: 'comments#moderate'
#new code widhout module
# scope '/admin' do
# resources :stats, only: [:index]
# end
#new code widh module
# scope '/admin', module: 'admin' do
# resources :stats, only: [:index]
# end
#When we want to route with a module and use that module's name as the URL prefix,
# we can use the namespace method instead of scope, module.
namespace :admin do
resources :stats, only: [:index]
end
root 'posts#index'
end