This project is archived and is in readonly mode.
Changeset [a0be389d39b790e0625339251d2674b8250b16b1] by Jon Leighton
January 4th, 2011 @ 12:24 AM
Allow assignment on has_one :through where the owner is a new record [#5137 state:resolved]
This required changing the code to keep the association proxy for a belongs_to around, despite its target being nil. Which in turn required various changes to the way that stale target checking is handled, in order to support various edge cases (loaded target is nil then foreign key added, foreign key is changed and then changed back, etc). A side effect is that the code is nicer and more succinct.
Note that I am removing test_no_unexpected_aliasing since that is basically checking that the proxy for a belongs_to does change, which is the exact opposite of the intention of this commit. Also adding various tests for various edge cases and related things.
Phew, long commit message!
https://github.com/rails/rails/commit/a0be389d39b790e0625339251d267...
Committed by Jon Leighton
- M activerecord/lib/active_record/associations.rb
- M activerecord/lib/active_record/associations/association_proxy.rb
- M activerecord/lib/active_record/associations/belongs_to_association.rb
- M activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb
- M activerecord/lib/active_record/associations/has_many_through_association.rb
- M activerecord/lib/active_record/associations/has_one_association.rb
- M activerecord/lib/active_record/associations/has_one_through_association.rb
- M activerecord/lib/active_record/associations/through_association.rb
- M activerecord/lib/active_record/autosave_association.rb
- M activerecord/test/cases/associations/belongs_to_associations_test.rb
- M activerecord/test/cases/associations/eager_test.rb
- M activerecord/test/cases/associations/has_one_through_associations_test.rb
- M activerecord/test/cases/autosave_association_test.rb
- M activerecord/test/cases/nested_attributes_test.rb
- M activerecord/test/models/company.rb
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>