路径助手生成带点而不是斜线的路径 [英] Path helpers generate paths with dots instead of slashes

查看:28
本文介绍了路径助手生成带点而不是斜线的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 routes.rb 中,我有以下内容:

In my routes.rb I have the following:

resources :message_threads

当我打电话时:

message_threads_path(1)

我明白了:

/message_threads.1

这是为什么?我的其他资源工作正常.我是不是正确地将其复数化了?

Why is this? My other resources work fine. Am I not pluralizing this correctly or something?

推荐答案

是的,这是一个复数错误.

Yes, this is a pluralization error.

通过传递 ID 1,我假设您希望显示单个记录.

By passing the ID 1, I assume that you wish to display a single record.

所以你需要使用单数的'message_thread':

So you need to use the singular 'message_thread':

message_thread_path(1)

哪个会产生:

http://localhost:3000/message_threads/1

这篇关于路径助手生成带点而不是斜线的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆