From 686e8fb52e00b24bd3a334cd7748df950914bfbf Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Sat, 10 Jun 2017 19:13:30 +0900 Subject: `Relation#locked?` should not build arel --- activerecord/lib/active_record/relation.rb | 2 +- activerecord/test/cases/relations_test.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 7a8f9abb36..133c1a6318 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -18,7 +18,7 @@ module ActiveRecord attr_reader :table, :klass, :loaded, :predicate_builder alias :model :klass alias :loaded? :loaded - alias :locked? :locked + alias :locked? :lock_value def initialize(klass, table, predicate_builder, values = {}) @klass = klass diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 86f3b0b962..5f36e4ec5d 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -2001,6 +2001,12 @@ class RelationTest < ActiveRecord::TestCase assert_equal binds, merged.bound_attributes end + def test_locked_should_not_build_arel + posts = Post.lock + assert posts.locked? + assert_nothing_raised { posts.lock!(false) } + end + def test_relation_join_method assert_equal "Thank you for the welcome,Thank you again for the welcome", Post.first.comments.join(",") end -- cgit v1.2.3