ruby on rails will

编程入门 行业动态 更新时间:2024-10-27 12:37:26
ruby on rails will_paginate更改默认链接(ruby on rails will_paginate change default link)

在routes.rb我设置列表routes.rb作为根:

root to: "lists#index"

我希望will_paginate创建页面href指向/?page=#而不是/lists?page=# 。 要创建分页链接,我在“lists#index”文件中有以下行:

<%= will_paginate @lists %>

In the routes.rb I set lists#index as the root:

root to: "lists#index"

I would like will_paginate to create page hrefs pointing to /?page=# instead of /lists?page=#. To create the paginate links I have the following line in the "lists#index" file:

<%= will_paginate @lists %>

最满意答案

我从你的问题中了解到你正在尝试创建一个自定义渲染器,尽管我从未使用它,但为此你需要重写渲染器的链接方法。 这里是链接到原始代码可能会有所帮助 - https://github.com/voormedia/paginary/blob/master/lib/paginary/helpers/pagination_helper.rb

What I understand from your question that you are trying to create a custom renderer, although I have never used it, but for that you need to override the link method of renderer. here is the link to the original code might be of some help - https://github.com/voormedia/paginary/blob/master/lib/paginary/helpers/pagination_helper.rb

更多推荐

本文发布于:2023-08-07 15:37:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464728.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:ruby   rails

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!