These are chat archives for shirasagi/shirasagi

23rd
May 2016
tany
@tany
May 23 2016 08:47

Mongoid / reorder

default_scope による order 定義を unscoped 以外で上書きするメソッド
Gws::Schedule::Plan.where({}).marshal_dump
=> [Gws::Schedule::Plan, :mongo, [], [], nil, nil, [true, false], {}, {:sort=>{"start_at"=>1}}]

Gws::Schedule::Plan.where({}).order(created: 1).marshal_dump
=> [Gws::Schedule::Plan, :mongo, [], [], nil, nil, [true, false], {}, {:sort=>{"start_at"=>1, "created"=>1}}]

Gws::Schedule::Plan.where({}).reorder(created: 1).marshal_dump
=> [Gws::Schedule::Plan, :mongo, [], [], nil, nil, [true, false], {}, {:sort=>{"created"=>1}}]