Rails RESTful 应用程序中的分页和排序 [英] Pagination and sorting in a Rails RESTful application

查看:21
本文介绍了Rails RESTful 应用程序中的分页和排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于如何在 Rails 应用程序中对资源实现排序和分页并仍然保持 RESTful 的任何提示?

如何以干净的方式映射页码和排序字段的参数?(我目前正在为我的应用程序中的每个资源使用 map.resources :x)

我应该了解其他任何涉及的性能问题吗?(例如缓存)

提前致谢.

编辑我将问题重新表述为一个更通用的问题,希望我能得到更多的答案.我将投票结束这个,因为它不再相关.感谢疯狂梦想家和 vrish88 的回答.

解决方案

您是否尝试过 will_paginate?是否有某种原因它不能满足您的特定需求?(http://github.com/mislav/will_paginate/tree/master)>

Any tips on how to implement sorting and pagination on a resource in a Rails application and still keeping it RESTful?

How do I map the parameters for page number and sort field in a clean way? (I am currently using map.resources :x for every resource in my app)

Any other performace issues involved that I should know about? (eg. caching)

Thanks in advance.

EDIT I reformulated the question into a more generic one, hoping that I will get more answers. I'm going to vote to close this one since it is no longer relevant. Thanks for the answers insane-dreamer and vrish88.

解决方案

Have you tried will_paginate? Is there some reason it doesn't meet your specific needs? (http://github.com/mislav/will_paginate/tree/master)

这篇关于Rails RESTful 应用程序中的分页和排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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