diff options
author | Ben Toews <mastahyeti@gmail.com> | 2017-09-26 09:29:24 -0600 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2017-11-09 22:41:33 +1030 |
commit | 5180fe2cd8233169935065efe8762bd5d7b2709c (patch) | |
tree | 73278df63c9938eb19e2ba1b333e07f70be88b0c /activerecord/test/models/author.rb | |
parent | 02a17492a937d4b423590644ad1481b82facd394 (diff) | |
download | rails-5180fe2cd8233169935065efe8762bd5d7b2709c.tar.gz rails-5180fe2cd8233169935065efe8762bd5d7b2709c.tar.bz2 rails-5180fe2cd8233169935065efe8762bd5d7b2709c.zip |
allow table name and direction in string order arg
Diffstat (limited to 'activerecord/test/models/author.rb')
-rw-r--r-- | activerecord/test/models/author.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/test/models/author.rb b/activerecord/test/models/author.rb index 11fe073ab0..f462fdb69a 100644 --- a/activerecord/test/models/author.rb +++ b/activerecord/test/models/author.rb @@ -8,9 +8,9 @@ class Author < ActiveRecord::Base has_many :posts_with_comments, -> { includes(:comments) }, class_name: "Post" has_many :popular_grouped_posts, -> { includes(:comments).group("type").having("SUM(comments_count) > 1").select("type") }, class_name: "Post" has_many :posts_with_comments_sorted_by_comment_id, -> { includes(:comments).order(Arel.sql("comments.id")) }, class_name: "Post" - has_many :posts_sorted_by_id_limited, -> { order(Arel.sql("posts.id")).limit(1) }, class_name: "Post" + has_many :posts_sorted_by_id_limited, -> { order("posts.id").limit(1) }, class_name: "Post" has_many :posts_with_categories, -> { includes(:categories) }, class_name: "Post" - has_many :posts_with_comments_and_categories, -> { includes(:comments, :categories).order(Arel.sql("posts.id")) }, class_name: "Post" + has_many :posts_with_comments_and_categories, -> { includes(:comments, :categories).order("posts.id") }, class_name: "Post" has_many :posts_with_special_categorizations, class_name: "PostWithSpecialCategorization" has_one :post_about_thinking, -> { where("posts.title like '%thinking%'") }, class_name: "Post" has_one :post_about_thinking_with_last_comment, -> { where("posts.title like '%thinking%'").includes(:last_comment) }, class_name: "Post" |