diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-01-02 23:42:16 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-02 23:42:16 +0900 |
commit | 260b273106168ba7a122c76c79a3b7f4a3209559 (patch) | |
tree | aef5d7e81524e15b0f33578b3c6dc654a5dacbe1 /activerecord/test | |
parent | b3aa86ca7ed28f2e9ab858fe1689010d39426018 (diff) | |
parent | 4c05434973fde5f6dcc7dd58d360be13e1f02a80 (diff) | |
download | rails-260b273106168ba7a122c76c79a3b7f4a3209559.tar.gz rails-260b273106168ba7a122c76c79a3b7f4a3209559.tar.bz2 rails-260b273106168ba7a122c76c79a3b7f4a3209559.zip |
Merge pull request #34836 from kamipo/class_level_update_without_ids
Restore an ability that class level `update` without giving ids
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/persistence_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb index 4830ff2b5f..d5057ad381 100644 --- a/activerecord/test/cases/persistence_test.rb +++ b/activerecord/test/cases/persistence_test.rb @@ -53,6 +53,20 @@ class PersistenceTest < ActiveRecord::TestCase assert_not_equal "2 updated", Topic.find(2).content end + def test_class_level_update_without_ids + topics = Topic.all + assert_equal 5, topics.length + topics.each do |topic| + assert_not_equal "updated", topic.content + end + + updated = Topic.update(content: "updated") + assert_equal 5, updated.length + updated.each do |topic| + assert_equal "updated", topic.content + end + end + def test_class_level_update_is_affected_by_scoping topic_data = { 1 => { "content" => "1 updated" }, 2 => { "content" => "2 updated" } } |