-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
class Article include Mongoid::Document embeds_many :comments field :title, localize: true end class Comment include Mongoid::Document embedded_in :article field :title, localize: true end
@article= Article.new @a= @article.comments.build(title: "A") @c= @article.comments.build(title: "C") @b= @article.comments.build(title: "B") @article.save! assert_equal @article.comments.asc(:title).to_a, [@a, @b, @c] #fails assert_equal @article.comments.desc(:title).to_a, [@c, @b, @a]
Full example app with the test case: https://github.com/semaperepelitsa/mongoid_rails_app/tree/embedded_sort_localized