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

查看:70
本文介绍了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天全站免登陆