aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2017-06-29 02:11:28 +0900
committerRyuta Kamizono <kamipo@gmail.com>2017-06-29 03:27:45 +0900
commit425f2cacafc522bb0aa426a0a4bc92c1237160aa (patch)
treea9029da50775261f071c1fa1c58aa0fed31f18dc /activerecord/test
parent686e8fb52e00b24bd3a334cd7748df950914bfbf (diff)
downloadrails-425f2cacafc522bb0aa426a0a4bc92c1237160aa.tar.gz
rails-425f2cacafc522bb0aa426a0a4bc92c1237160aa.tar.bz2
rails-425f2cacafc522bb0aa426a0a4bc92c1237160aa.zip
Remove delegating to arel in a relation
The delegation was needed since passing `relation` with `relation.bound_attributes`. It should use `relation.arel` in that case.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/relations_test.rb2
-rw-r--r--activerecord/test/models/post.rb1
2 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index 5f36e4ec5d..84ccfbf5d5 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -2002,7 +2002,7 @@ class RelationTest < ActiveRecord::TestCase
end
def test_locked_should_not_build_arel
- posts = Post.lock
+ posts = Post.locked
assert posts.locked?
assert_nothing_raised { posts.lock!(false) }
end
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index 4c913b3b72..ed64e0ee52 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -22,6 +22,7 @@ class Post < ActiveRecord::Base
scope :ranked_by_comments, -> { order("comments_count DESC") }
scope :limit_by, lambda { |l| limit(l) }
+ scope :locked, -> { lock }
belongs_to :author
belongs_to :readonly_author, -> { readonly }, class_name: "Author", foreign_key: :author_id