references_many :default_order not respected

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • 2.1.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      class Comment
      include Mongoid::Document

      field :content

      referenced_in :post
      end

      class Post
      include Mongoid::Document

      field :title

      references_many :comments, :default_order => :_id.desc
      end

      <pre>
      post = Post.create :title => 'new post'
      post.comments.create :content => 'c1'
      post.comments.create :content => 'c2'
      </pre>

      For 2.0.0.beta.19 the following code work as expected:

      > post.comments.map(&:content) => ["c2", "c1"]

      But for 2.0.0.rc.6 the :default_order is ignored:

      > post.comments.map(&:content) => ["c1", "c2"]

              Assignee:
              Unassigned
              Reporter:
              Stone, Gao
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: