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