Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug that makes named_scopes _forgot_ current scope
- Loading branch information
1 parent
92a30b0
commit 0dd2f96
Showing
3 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0dd2f96
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is a little brittle and fails on other adapters that do not explicitly fall back to a secondary sort of id ASC. Since there are duplicate records with comments_count equal to one another. I have found that named_scope :ranked_by_comments, :order => "comments_count DESC, id ASC" fixes the ambiguity.