Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-1745

Ordering by embedded doc's localized field doesn't work

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.4.5
    • 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

            Assignee:
            Unassigned Unassigned
            Reporter:
            semaperepelitsa semaperepelitsa
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: