Rails 5.1 Routes: dynamic :action parameters

前端 未结 3 1688
后悔当初
后悔当初 2021-02-05 09:45

Rails 5.0.0.beta4 introduced a deprecation warning on routes containing dynamic :action and :controller segments:

DEPRECATION WARNING: Using a dynamic :action s         


        
3条回答
  •  心在旅途
    2021-02-05 10:26

    Is not the same case as you, but I did this:

    class PagesController < ApplicationController
      def index
        render params[:path]
      end
    end
    

    Routes:

    get ':path', to: 'pages#index'
    

    I suppose if I want a nested path I will use *:

    get '*path', to: 'pages#index'
    

提交回复
热议问题