Nexus Weblogging
ChinaonRails
You are here ChinaonRails > Ruby on Rails > > 金箍棒画的圈,详解Named scope

bd7lx


58.189%

disconnected
登录后回复主题 | 跳到回复(7)

金箍棒画的圈,详解Named scope

... by bd7lx ... 3 月 15 天前 ... 210 次点击

不是防妖怪接近,而是方便自己寻找



http://ryandaigle.com/articles/2008/8/20/named-scope-it-s-not-just-for-conditions-ya-know

作为Rails2.1的新特性named_scope,秘密武器has_finder

1 - 8-25 10:23
bd7lx 楼主 深圳
http://www.thewebfellas.com/blog/2008/8/24/giving-composed_of-some-much-needed-lovin

named_scope尽显风采之际

不忘记给composed_of点关爱

AR内置了聚合功能,aggregate类的构建器初始化改进,新的options选项参数constructor和converter:

http://rails.lighthouseapp.com/projects/8994/tickets/892-composed_of-constructor-and-converter-options
2 - 8-26 8:56
bd7lx 楼主 深圳
http://locomotivation.com/2008/08/25/simplify-activerecord-aggregates-and-other-goodies-via-named_scope

唯恐世人不知有named_scope
3 - 8-28 10:13
bd7lx 楼主 深圳
4 - 10-5 13:24
bd7lx 楼主 深圳
http://github.com/metaskills/named_scope/tree/master

兼顾低版本的
Rails 1.2.6 and 2.0.4
5 - 10-15 8:46
bd7lx 楼主 深圳
插件pacecar

http://giantrobots.thoughtbot.com/2008/10/14/life-in-the-fast-lane

为活动记录AR的model提供named_scoped 类方法

Pacecar is a plugin for rails application which gives your ActiveRecord models a bunch of class methods based (mostly) on database introspection.

It looks at column names and types to generate named_scope methods at load time which can be used in your app and combined with other named_scopes as well.



定速車(在賽車預備圈跑道上帶頭行駛但不參加比賽)
6 - 10-16 10:48
bd7lx 楼主 深圳
http://github.com/yfactorial/utility_scopes/tree/master

跟pacecar类似功能的Utility scopes

provides a collection of utilitarian named scopes for use with your ActiveRecord models.
7 - 10-21 11:50
bd7lx 楼主 深圳
看完之后有话想说?那就帮楼主加盖一层吧!

在回复之前你需要先进行登录
电子邮件或昵称
密码
© 2007 A Jesse Cai Production   -   About   -   京ICP备07020911号
a site powered by Project Babel