新手问题 请问 mongoid has_many 带上 scope 要怎么写

dxwts · 2014年12月12日 · 1600 次阅读

sqlite 好像可以按下面的方法写,但我用了 mongoid 这样写却不行。

has_many :comments, -> { order "posted_on" }
has_many :comments, -> { includes :author }
has_many :people, -> { where("deleted = 0").order("name") }, class_name: "Person"
has_many :tracks, -> { order "position" }, dependent: :destroy
has_many :reports, -> { readonly }
暂无回复。
需要 登录 后方可回复, 如果你还没有账号请 注册新账号