class HasManyAssociationsTestForReorderWithJoinDependency

Public Instance Methods

test_should_generate_valid_sql() click to toggle source
# File activerecord/test/cases/associations/has_many_associations_test.rb, line 47
def test_should_generate_valid_sql
  author = authors(:david)
  # this can fail on adapters which require ORDER BY expressions to be included in the SELECT expression
  # if the reorder clauses are not correctly handled
  assert author.posts_with_comments_sorted_by_comment_id.where("comments.id > 0").reorder("posts.comments_count DESC", "posts.tags_count DESC").last
end