diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-01-03 23:48:53 +0000 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-03 16:24:32 -0800 |
commit | 40afcade0dc1450e765a91fc15a6ac6d442c9826 (patch) | |
tree | 4d205b197a761fcd8b74854ebf4cc0139277a280 /activesupport | |
parent | 2120da7f733ba33183a42e71256db9652c5f5fcc (diff) | |
download | rails-40afcade0dc1450e765a91fc15a6ac6d442c9826.tar.gz rails-40afcade0dc1450e765a91fc15a6ac6d442c9826.tar.bz2 rails-40afcade0dc1450e765a91fc15a6ac6d442c9826.zip |
Remove undocumented feature from has_one where you could pass false as the second parameter to build_assoc or create_assoc, and the existing associated object would be untouched (the foreign key would not be nullified, and it would not be deleted). If you want behaviour similar to this you can do the following things:
* Use :dependent => :nullify (or don't specify :dependent) if you want to prevent the existing associated object from being deleted
* Use has_many if you actually want multiple associated objects
* Explicitly set the foreign key if, for some reason, you really need to have multiple objects associated with the same has_one. E.g.
previous = obj.assoc
obj.create_assoc
previous.update_attributes(:obj_id => obj.id)
Diffstat (limited to 'activesupport')
0 files changed, 0 insertions, 0 deletions