全部のっけ
resources :posts
get '/posts', to: 'posts#index' get '/posts/new', to: 'posts#new', as: 'new_post' post '/posts', to: 'posts#create' get '/posts/:id', to: 'posts#show', as: 'post' get '/posts/:id/edit', to: 'posts#edit', as: 'edit_post' patch '/posts/:id', to: 'posts#update' delete '/posts/:id', to: 'posts#destroy'
絞る
resources :posts, only: [:index, :show]
もしくは
resources :posts, only: %i[ index show ]
get '/posts', to: 'posts#index' get '/posts/:id', to: 'posts#show', as: 'post'
除く
resources :posts, except: [:destroy, :show, :edit]
もしくは
resources :posts, except: %i[ destroy show edit ]
get '/posts', to: 'posts#index' get '/posts/new', to: 'posts#new', as: 'new_post' post '/posts', to: 'posts#create' patch '/posts/:id', to: 'posts#update'