-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Table Context to Order Hash #12610
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ def greeting | |
|
||
scope :containing_the_letter_a, -> { where("body LIKE '%a%'") } | ||
scope :ranked_by_comments, -> { order("comments_count DESC") } | ||
scope :ranked_by_comments_hash, -> { order(comments_count: :desc) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we could add a new test case for hashes with multiple elements. WDYT? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense to me, and would probably break my fix, assuming you mean: scope :ranked_by_comments_hash, -> { order(comments_count: :desc, subject: :asc) } There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. this is what I'm meaning. |
||
|
||
scope :limit_by, lambda {|l| limit(l) } | ||
|
||
|
@@ -40,6 +41,8 @@ def first_comment | |
scope :with_comments, -> { preload(:comments) } | ||
scope :with_tags, -> { preload(:taggings) } | ||
|
||
scope :comment, -> { order(type: :desc) } | ||
|
||
has_many :comments do | ||
def find_most_recent | ||
order("id DESC").first | ||
|
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.
Please move this changelog entry to the first line