public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Revert "Ensure that save on child object fails for invalid belongs_to 
association. Closes #11555. [rubyruy]"

This reverts commit c67e985994362290308073ed2793dd8e7f2a76db.
NZKoz (author)
Thu Apr 10 21:04:11 -0700 2008
commit  2e74177d0b61f872b773285471ff9025f0eaa96c
tree    fd87aba4296290394e536ee0549aa33d8a19fe78
parent  ed99dda174da439a0947cdabea3babf027c672ac
...
2
3
4
5
6
7
8
9
...
2
3
4
 
 
5
6
7
0
@@ -2,8 +2,6 @@
0
 
0
 * Change validates_uniqueness_of :case_sensitive option default back to true (from [9160]).  Love your database columns, don't LOWER them.  [rick]
0
 
0
-* Ensure that save on child object fails for invalid belongs_to association. Closes #11555. [rubyruy]
0
-
0
 * Add support for interleaving migrations by storing which migrations have run in the new schema_migrations table. Closes #11493 [jordi]
0
 
0
 * ActiveRecord::Base#sum defaults to 0 if no rows are returned.  Closes #11550 [kamal]
...
922
923
924
925
926
927
928
929
...
922
923
924
 
 
925
926
927
0
@@ -922,8 +922,6 @@ module ActiveRecord
0
           )
0
         end
0
 
0
-        add_single_associated_save_callbacks(reflection.name)
0
-
0
         configure_dependency_for_belongs_to(reflection)
0
       end
0
 
...
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
...
377
378
379
 
 
 
 
 
 
 
 
 
 
 
 
380
0
@@ -377,16 +377,4 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase
0
     assert companies(:first_client).readonly_firm.readonly?
0
   end
0
 
0
-  def test_save_fails_for_invalid_belongs_to
0
-    log = AuditLog.new
0
-    assert log.valid?
0
-
0
-    log.build_developer # Build invalid association
0
-    assert !log.developer.valid?
0
-    assert !log.valid?
0
-    assert_equal "is invalid", log.errors.on("developer")
0
-    
0
-    assert !log.save
0
-  end
0
-
0
 end

Comments

mislav Fri Apr 11 02:36:30 -0700 2008

Shouldn’t we add a test that discovered the issue and lead to this revert?

lifo Fri Apr 11 05:27:42 -0700 2008

But yeah, we need to add a test

SDS Fri Apr 11 13:57:10 -0700 2008

lifo sux ;)

mislav Fri Apr 11 14:42:52 -0700 2008

haha :) but seriously, lifo is cool