aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-02-24 08:23:43 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-02-24 08:23:43 +0900
commit15da1fb35b41a94bdd6b75b249f83572400843d7 (patch)
treeb89a0d44fd8013036645d3beef938b526e3b3fd3 /activerecord
parentdf2765ac0310d7c990fff333ab72f71d01137bf6 (diff)
downloadrails-15da1fb35b41a94bdd6b75b249f83572400843d7.tar.gz
rails-15da1fb35b41a94bdd6b75b249f83572400843d7.tar.bz2
rails-15da1fb35b41a94bdd6b75b249f83572400843d7.zip
Add test case for `unscope` with unknown column
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/relations_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index b28e2910bb..61b69f2de5 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -1941,6 +1941,17 @@ class RelationTest < ActiveRecord::TestCase
assert_equal p2.first.comments, comments
end
+ def test_unscope_with_unknown_column
+ comment = comments(:greetings)
+ comment.update!(comments: 1)
+
+ comments = Comment.where(comments: 1).unscope(where: :unknown_column)
+ assert_equal [comment], comments
+
+ comments = Comment.where(comments: 1).unscope(where: { comments: :unknown_column })
+ assert_equal [comment], comments
+ end
+
def test_unscope_specific_where_value
posts = Post.where(title: "Welcome to the weblog", body: "Such a lovely day")