Rails 中的 Kaminari 链接 URL 路由问题:\
找不到类似的帖子,所以就到这里了。
我刚刚安装了 Kaminari 来进行分页。在主页上,它工作得很好,但是,在我的类别页面上却没有:
类别 URL: http://localhost:3000/categories/1
然而,Kaminari 正在创建的 URL 看起来并不正确: http://localhost:3000/categories/show?id=1&page=2
我想它应该类似于 http://localhost:3000/categories/1/? page=2(当我手动输入时有效)。
我怎样才能让Kaminari使用工作链接结构或者我需要在routes.rb中更改一些内容?
预先感谢您的帮助:) 非常感谢!
Wasn't able to find a similar thread, so here goes.
I just installed Kaminari for pagination. On the homepage, it worked perfectly, however, on my category pages it didn't:
Category URL:
http://localhost:3000/categories/1
The URLs Kaminari is creating, however, doesn't look right:
http://localhost:3000/categories/show?id=1&page=2
I would imagine it should be something like http://localhost:3000/categories/1/?page=2 (which works when I type it in manually).
How might I get Kaminari to use the working link structure or is there something I need to change in routes.rb?
Thanks in advance for your help :) It is greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我明白发生了什么事。
之外,我还得到了
get“categories/show” ,一切都完美运行:)
除了
资源:类别
在我的routes.rb中,一旦我注释掉了get行,
I figured out what was going on.
In my routes.rb I had
get "categories/show"
in addition to
resources :categories
as soon as I commented out the get line, it all worked perfectly :)