diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-02-24 08:23:43 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2019-02-24 08:23:43 +0900 |
commit | 15da1fb35b41a94bdd6b75b249f83572400843d7 (patch) | |
tree | b89a0d44fd8013036645d3beef938b526e3b3fd3 /activerecord/test/cases | |
parent | df2765ac0310d7c990fff333ab72f71d01137bf6 (diff) | |
download | rails-15da1fb35b41a94bdd6b75b249f83572400843d7.tar.gz rails-15da1fb35b41a94bdd6b75b249f83572400843d7.tar.bz2 rails-15da1fb35b41a94bdd6b75b249f83572400843d7.zip |
Add test case for `unscope` with unknown column
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 11 |
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") |