-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
Refers to MONGOID-2598
Mongoid 3.1.4
class Whatever include Mongoid::Document field :name, localize: true default_scope asc(:name) end
[2] pry(main)> I18n.locale = "en" => "en" [3] pry(main)> Whatever.all => #<Mongoid::Criteria selector: {} options: {:sort=>{"name.en"=>1}} class: Whatever embedded: false> [4] pry(main)> I18n.locale = "es" => "es" # Note the locale in the scope didn't change here... [5] pry(main)> Whatever.all => #<Mongoid::Criteria selector: {} options: {:sort=>{"name.en"=>1}} class: Whatever embedded: false> # This works as expected [6] pry(main)> Whatever.unscoped.asc(:name) => #<Mongoid::Criteria selector: {} options: {:sort=>{"name.es"=>1}} class: Whatever embedded: false>