How to route controllers without CRUD actions?

前端 未结 3 1424
我寻月下人不归
我寻月下人不归 2021-01-01 22:12

I have a controller with a number of actions:

class TestsController < ApplicationController
   def find
   end

   def break
   end

   def turn
   end
en         


        
3条回答
  •  耶瑟儿~
    2021-01-01 22:37

    You can specify actions you want to route like this:

    resources :tests, except: [:new, :create, :edit, :update, :destroy] do 
      collection do 
        get 'find'
        get 'break'
        get 'turn'
      end 
    end
    

提交回复
热议问题