diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-01-28 19:20:50 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-01-28 19:20:55 +0000 |
commit | 74871961eccdb455f18e8ef66716041f2f828ba8 (patch) | |
tree | 4cbeb7933b293057899b35e3476a40cbf0b935fb /activerecord/test/cases/base_test.rb | |
parent | 2ae8d3079b96d343f8cea8513929d656013f880e (diff) | |
download | rails-74871961eccdb455f18e8ef66716041f2f828ba8.tar.gz rails-74871961eccdb455f18e8ef66716041f2f828ba8.tar.bz2 rails-74871961eccdb455f18e8ef66716041f2f828ba8.zip |
Add array id support to Model.update_counters. [#1254 state:resolved] [Carlos JĂșnior]
Diffstat (limited to 'activerecord/test/cases/base_test.rb')
-rwxr-xr-x | activerecord/test/cases/base_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 0f03dae829..973bb567bd 100755 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -639,6 +639,13 @@ class BasicsTest < ActiveRecord::TestCase category.reload assert_not_nil category.categorizations_count assert_equal 4, category.categorizations_count + + category_2 = categories(:technology) + count_1, count_2 = (category.categorizations_count || 0), (category_2.categorizations_count || 0) + Category.update_counters([category.id, category_2.id], "categorizations_count" => 2) + category.reload; category_2.reload + assert_equal count_1 + 2, category.categorizations_count + assert_equal count_2 + 2, category_2.categorizations_count end def test_update_all |