aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-05-06 22:21:38 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-05-06 22:21:38 +0900
commit2ee96632b640da0d09b164ed67b1a9f6b96594b3 (patch)
tree0d469ebadd2ddf538b0efd2eac8b776675230864 /activerecord/test
parente5434b038985906f17b3663766a0588dd8998b17 (diff)
downloadrails-2ee96632b640da0d09b164ed67b1a9f6b96594b3.tar.gz
rails-2ee96632b640da0d09b164ed67b1a9f6b96594b3.tar.bz2
rails-2ee96632b640da0d09b164ed67b1a9f6b96594b3.zip
Delegate `ast` and `locked` to `arel` explicitly
Currently `ast` and `locked` are used in the internal but delegating to `arel` is depend on `method_missing`. If a model class is defined these methods, `select_all` will be broken. It should be delegated to `arel` explicitly.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/relation/merging_test.rb2
-rw-r--r--activerecord/test/models/category.rb9
2 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/test/cases/relation/merging_test.rb b/activerecord/test/cases/relation/merging_test.rb
index 64866eaf2d..c3b39a9295 100644
--- a/activerecord/test/cases/relation/merging_test.rb
+++ b/activerecord/test/cases/relation/merging_test.rb
@@ -56,7 +56,7 @@ class RelationMergingTest < ActiveRecord::TestCase
def test_relation_merging_with_locks
devs = Developer.lock.where("salary >= 80000").order("id DESC").merge(Developer.limit(2))
- assert devs.locked.present?
+ assert devs.locked?
end
def test_relation_merging_with_preload
diff --git a/activerecord/test/models/category.rb b/activerecord/test/models/category.rb
index e8654dca01..4b2840c653 100644
--- a/activerecord/test/models/category.rb
+++ b/activerecord/test/models/category.rb
@@ -29,6 +29,15 @@ class Category < ActiveRecord::Base
has_many :authors_with_select, -> { select "authors.*, categorizations.post_id" }, through: :categorizations, source: :author
scope :general, -> { where(name: "General") }
+
+ # Should be delegated `ast` and `locked` to `arel`.
+ def self.ast
+ raise
+ end
+
+ def self.locked
+ raise
+ end
end
class SpecialCategory < Category