[Ruby on Rails] How to limit default actions with 'only' while adding custom actions
A memo on how to limit default actions with ‘only’ while adding custom actions in Ruby on Rails routing configuration.
resources :blogs, only: %w[index show] do
collection do
get 'search'
end
end
When you run rake routes, you should see blogs#search added in addition to blogs#index and blogs#show.
That’s all from the Gemba.