aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/post.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/models/post.rb')
-rw-r--r--activerecord/test/models/post.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index 49bbbaaab7..4508f727d0 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -35,8 +35,8 @@ class Post < ActiveRecord::Base
def first_comment
super.body
end
- has_one :first_comment, -> { order(Arel.sql("id ASC")) }, class_name: "Comment"
- has_one :last_comment, -> { order(Arel.sql("id desc")) }, class_name: "Comment"
+ has_one :first_comment, -> { order("id ASC") }, class_name: "Comment"
+ has_one :last_comment, -> { order("id desc") }, class_name: "Comment"
scope :with_special_comments, -> { joins(:comments).where(comments: { type: "SpecialComment" }) }
scope :with_very_special_comments, -> { joins(:comments).where(comments: { type: "VerySpecialComment" }) }
@@ -52,7 +52,7 @@ class Post < ActiveRecord::Base
has_many :comments do
def find_most_recent
- order(Arel.sql("id DESC")).first
+ order("id DESC").first
end
def newest
@@ -323,5 +323,9 @@ class FakeKlass
def enforce_raw_sql_whitelist(*args)
# noop
end
+
+ def attribute_names_and_aliases
+ []
+ end
end
end