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 4 路径辅助轨道返回“;型号.ID“;而不是",;型号/ID“;_Ruby On Rails 4_Path_Helper - Fatal编程技术网

Ruby on rails 4 路径辅助轨道返回“;型号.ID“;而不是",;型号/ID“;

Ruby on rails 4 路径辅助轨道返回“;型号.ID“;而不是",;型号/ID“;,ruby-on-rails-4,path,helper,Ruby On Rails 4,Path,Helper,我有一个名为“topic”的AR模型 我尝试使用以下帮助器路径: topic_path(42) # return => "domaine.exemple/topic.42" instead of "domaine.exemple/topic/42" 我的路线已由“ressource”生成 怎么了?您应该使用资源(复数),而不是资源(单数),因为您有多个资源: resources :topics, shallow: true 弗雷尔。。。就是这样。谢谢!但型号名称必须保持单数:“资源:

我有一个名为“topic”的AR模型

我尝试使用以下帮助器路径:

topic_path(42) # return => "domaine.exemple/topic.42" instead of "domaine.exemple/topic/42"
我的路线已由“ressource”生成


怎么了?

您应该使用
资源
(复数),而不是
资源
(单数),因为您有多个资源:

resources :topics, shallow: true 

弗雷尔。。。就是这样。谢谢!但型号名称必须保持单数:“资源:主题…”
resources :topics, shallow: true