While this generally contradicts our design principles, we need the controller to perform its #create action on a GET request (this is part of a workflow that includes a series of redirects for an external service). Does anyone know which particular way to do this? I really don't want to go beyond the inventive routing structure provided by Rails routes. We do not need the #index action, which usually responds to this GET request.
I found (surprisingly) that this works, but I don’t know if it was planned, or if we will use the error in Rails and risk breaking later:
resources :agreements, :except => [:index, :create] do get :create, :on => :collection end
If this get :create was get :something , we would have a route like
Helper: something_agreement_path Request: GET /agreements/:agreement_id/something Action: agreements
But Rails actually generates what we want:
Helper: agreements_path Request: GET /agreements Action: agreements
Error or function?
source share