1. 10 5月, 2011 1 次提交
  2. 11 3月, 2011 2 次提交
  3. 01 3月, 2011 2 次提交
  4. 22 2月, 2011 1 次提交
  5. 18 2月, 2011 4 次提交
  6. 08 2月, 2011 2 次提交
  7. 05 2月, 2011 1 次提交
  8. 04 2月, 2011 1 次提交
  9. 17 1月, 2011 4 次提交
  10. 12 1月, 2011 10 次提交
  11. 08 1月, 2011 2 次提交
  12. 07 1月, 2011 1 次提交
  13. 04 1月, 2011 5 次提交
    • J
      Remove undocumented feature from has_one where you could pass false as the... · 40afcade
      Jon Leighton 提交于
      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)
      40afcade
    • J
      When preloading a belongs_to, the target should still be set (to nil) if there... · a9bed985
      Jon Leighton 提交于
      When preloading a belongs_to, the target should still be set (to nil) if there is no foreign key present. And the loaded flag should be set on the association proxy. This then allows us to remove the foreign_key_present? check from BelongsToAssociation#find_target. Also added a test for the same thing on polymorphic associations.
      a9bed985
    • J
      Allow assignment on has_one :through where the owner is a new record [#5137 state:resolved] · a0be389d
      Jon Leighton 提交于
      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!
      a0be389d
    • J
    • J
      d18a2703
  14. 01 1月, 2011 3 次提交
  15. 27 12月, 2010 1 次提交