aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-09-27 13:25:14 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-09-27 13:25:14 +0900
commit801ccab22a8efc2611300a14a8b373a43aa0de28 (patch)
treebbf708272660796a96aa6be02994c349feec7643 /activerecord/test/models
parent48ef5e0ad500bdba706f10b65456f3b03b556212 (diff)
downloadrails-801ccab22a8efc2611300a14a8b373a43aa0de28.tar.gz
rails-801ccab22a8efc2611300a14a8b373a43aa0de28.tar.bz2
rails-801ccab22a8efc2611300a14a8b373a43aa0de28.zip
Add test case for `arel_attribute` with a custom table
Since #29301, `arel_attribute` respects a custom table name.
Diffstat (limited to 'activerecord/test/models')
-rw-r--r--activerecord/test/models/post.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index 4c8e847354..935a11e811 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -21,7 +21,7 @@ class Post < ActiveRecord::Base
scope :containing_the_letter_a, -> { where("body LIKE '%a%'") }
scope :titled_with_an_apostrophe, -> { where("title LIKE '%''%'") }
- scope :ranked_by_comments, -> { order("comments_count DESC") }
+ scope :ranked_by_comments, -> { order(arel_attribute(:comments_count).desc) }
scope :limit_by, lambda { |l| limit(l) }
scope :locked, -> { lock }