新手问题 Mongoid has_many sort

tanjianna · 2012年09月24日 · 最后由 rainlife 回复于 2012年09月26日 · 2610 次阅读

例如我有两张表:

brands 和 devices brand has_many devices devices belongs_to brand

我现在想 Brand.find(params[:id]) 遍历 Brand 和 Devices 并且 Devices List 需要根据 create_time 来排序!我该如何做好?

default_scope ?

需要 登录 后方可回复, 如果你还没有账号请 注册新账号