Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/56.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/7/symfony/6.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,我使用link\u to\u active gem根据当前url添加“active”类。例如,我的要求是: 学生资源包括: /students /students/new /students/id /students/id/edit 我对链接的使用处于活动状态:是 <%= link_to "Students", students_path, class: "list-group-item", active_on: students_path%> 显然,students_pat

我使用link\u to\u active gem根据当前url添加“active”类。例如,我的要求是:

学生资源包括:

/students
/students/new
/students/id
/students/id/edit
我对链接的使用处于活动状态:是

<%= link_to "Students", students_path, class: "list-group-item", active_on: students_path%>


显然,students_path仅与/students一致,但如果我希望在访问上述后续链接时保持此链接的活动状态,该怎么办。我该怎么做呢?

你有没有看过这个宝石,它可以在控制器级别上匹配