aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorganesh <ganesh@ganesh-laptop.(none)>2011-06-04 00:04:59 +0530
committerganesh <ganesh@ganesh-laptop.(none)>2011-06-04 00:04:59 +0530
commit5f66f7a9a2e497fdb8f8cbbfb423d9b3b199fd54 (patch)
treed22667c683c0cd4a67fd819a036669dc0285887a /activerecord
parent64325a82427120cf7659c80e1b67ca1ffb01ebc4 (diff)
downloadrails-5f66f7a9a2e497fdb8f8cbbfb423d9b3b199fd54.tar.gz
rails-5f66f7a9a2e497fdb8f8cbbfb423d9b3b199fd54.tar.bz2
rails-5f66f7a9a2e497fdb8f8cbbfb423d9b3b199fd54.zip
added more tests for update_column
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/associations/belongs_to_associations_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb
index 5a900e0605..7338513b41 100644
--- a/activerecord/test/cases/associations/belongs_to_associations_test.rb
+++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb
@@ -296,6 +296,15 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase
assert_equal 1, Topic.find(topic.id)[:replies_count]
end
+ def test_belongs_to_counter_when_update_column
+ topic = Topic.create!(:title => "37s")
+ topic.replies.create!(:title => "re: 37s", :content => "rails")
+ assert_equal 1, Topic.find(topic.id)[:replies_count]
+
+ topic.update_column(:content, "rails is wonderfull")
+ assert_equal 1, Topic.find(topic.id)[:replies_count]
+ end
+
def test_assignment_before_child_saved
final_cut = Client.new("name" => "Final Cut")
firm = Firm.find(1)