Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.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 非资源路由与动态分段_Ruby On Rails - Fatal编程技术网

Ruby on rails 非资源路由与动态分段

Ruby on rails 非资源路由与动态分段,ruby-on-rails,Ruby On Rails,我的路线文件里有这个 get '/registrations/:student_id/:subject_id' => "registrations#show", :as => 'custom' 现在我想在link\u to helper中使用它,这样我就可以发送student\u id和subject\u id来显示控制器的动作 <%= link_to "Custom" .... %> 假设您的视图中有可用的实例变量@student\u id和@subject\u i

我的路线文件里有这个

get '/registrations/:student_id/:subject_id' => "registrations#show", :as => 'custom'
现在我想在link\u to helper中使用它,这样我就可以发送student\u id和subject\u id来显示控制器的动作

<%= link_to "Custom" .... %>

假设您的视图中有可用的实例变量@student\u id和@subject\u id,那么这应该可以:

<%= link_to "Custom", custom_path(@student_id, @subject_id) %>

看起来类似于这个问题,同样的解决方案也可以应用

看起来问题与此类似。