diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-05-02 16:46:30 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-05-02 16:46:30 +0000 |
commit | 24a9050b6e34c859909f4e16ee68b8b34407a771 (patch) | |
tree | 777e5811e895dedfa83ade91b17a1a1d2b1db147 /activerecord/test | |
parent | 74a612c4a15f3094e478aa79eb63b27efec8358a (diff) | |
download | rails-24a9050b6e34c859909f4e16ee68b8b34407a771.tar.gz rails-24a9050b6e34c859909f4e16ee68b8b34407a771.tar.bz2 rails-24a9050b6e34c859909f4e16ee68b8b34407a771.zip |
Changed the callbacks such that observers are notified before the in-object callbacks are triggered. Without this change, it wasn't possible to act on the whole object in something like a before_destroy observer without having the objects own callbacks (like deleting associations) called first.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1273 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/base_test.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb index 595450eab9..9185d05c8a 100755 --- a/activerecord/test/base_test.rb +++ b/activerecord/test/base_test.rb @@ -200,7 +200,6 @@ class BasicsTest < Test::Unit::TestCase topic.written_on = "2003-12-12 23:23:00" topic.save topic.destroy - assert_raise(TypeError) { topic.save } assert_raise(ActiveRecord::RecordNotFound) { Topic.find(topic.id) } end @@ -434,6 +433,14 @@ class BasicsTest < Test::Unit::TestCase assert client.frozen? end + def test_destroy_record_with_associations + client = Client.find(3) + client.destroy + assert client.frozen? + assert_kind_of Firm, client.firm + assert_raises(TypeError) { client.name = "something else" } + end + def test_update_attribute assert !Topic.find(1).approved? Topic.find(1).update_attribute("approved", true) |