diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-06-10 19:13:30 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-06-20 13:10:07 +0900 |
commit | 686e8fb52e00b24bd3a334cd7748df950914bfbf (patch) | |
tree | b7a8ecb4cc048c141912d48c8c7793c8789f746c /activerecord | |
parent | 09cb26bc1e653999827cf3eb955d42a2c932b3f5 (diff) | |
download | rails-686e8fb52e00b24bd3a334cd7748df950914bfbf.tar.gz rails-686e8fb52e00b24bd3a334cd7748df950914bfbf.tar.bz2 rails-686e8fb52e00b24bd3a334cd7748df950914bfbf.zip |
`Relation#locked?` should not build arel
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 6 |
2 files changed, 7 insertions, 1 deletions
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 |