Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/52.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 在Rails 4中重定向一个url,其中只包含一些get参数_Ruby On Rails_Ruby On Rails 4_Routes_Ruby 2.1 - Fatal编程技术网

Ruby on rails 在Rails 4中重定向一个url,其中只包含一些get参数

Ruby on rails 在Rails 4中重定向一个url,其中只包含一些get参数,ruby-on-rails,ruby-on-rails-4,routes,ruby-2.1,Ruby On Rails,Ruby On Rails 4,Routes,Ruby 2.1,我正在开发一个应用程序,它仍然应该响应以前web应用程序中的一些旧URL。我只想在存在参数(get param)时构建一些重定向到操作。比如说 get '/students/:id?school_id=(:id)', to: redirect { |params, req| # path of the a known action here } 它将如何识别如下URL: /students/:id?school\u id=25957 但不是像这样的URL: /students/:id

我正在开发一个应用程序,它仍然应该响应以前web应用程序中的一些旧URL。我只想在存在参数(get param)时构建一些重定向到操作。比如说

get '/students/:id?school_id=(:id)', to: redirect { |params, req|
     # path of the a known action here
}
它将如何识别如下URL:

/students/:id?school\u id=25957

但不是像这样的URL:

/students/:id?address=345