Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 12 lines (9 sloc) 521 Bytes
OHM源码阅读笔记;
ohm的set: # An implementation which relies on *SMEMBERS* and yields an instance
methods:
Set里面:
replace:操作是先将当前collection清空然后将新的modle 迭代add 加入
sort: 使用ruby的sort会将所有的实例载入到array里进行sort
find: Post.find is actually just a wrapper around Post.all.find
#意味着执行find时会首先将所有实例载入内存,此处加index避免
model里面除了通过id,find其他都需要定义index