1. 03 1月, 2015 1 次提交
    • C
      Deprecate `false` as the way to halt AS callbacks · d217daf6
      claudiob 提交于
      After this commit, returning `false` in a callback will display a deprecation
      warning to make developers aware of the fact that they need to explicitly
      `throw(:abort)` if their intention is to halt a callback chain.
      
      This commit also patches two internal uses of AS::Callbacks (inside
      ActiveRecord and ActionDispatch) which sometimes return `false` but whose
      returned value is not meaningful for the purpose of execution.
      
      In both cases, the returned value is set to `true`, which does not affect the
      execution of the callbacks but prevents unrequested deprecation warnings from
      showing up.
      d217daf6
  2. 29 11月, 2014 1 次提交
  3. 13 10月, 2014 1 次提交
    • A
      Autosave callbacks shouldn't be `after_save` · 719d52db
      Agis- 提交于
      068f092c registered autosave callbacks
      as `after_save` callbacks. This caused the regression described in #17209.
      
      Autosave callbacks should be registered as `after_update` and
      `after_create` callbacks, just like before.
      
      This is a partial revert of 068f092c.
      
      Fixes #17209.
      719d52db
  4. 18 9月, 2014 1 次提交
  5. 15 9月, 2014 1 次提交
  6. 06 9月, 2014 1 次提交
  7. 18 6月, 2014 1 次提交
    • S
      Don't save through records twice · 068f092c
      Sean Griffin 提交于
      If the through record gets created in an `after_create` hook that is
      defined before the association is defined (therefore after its
      `after_create` hook) get saved twice. This ensures that the through
      records are created only once, regardless of the order of the hooks.
      068f092c
  8. 10 6月, 2014 1 次提交
  9. 27 5月, 2014 1 次提交
  10. 25 5月, 2014 1 次提交
  11. 21 5月, 2014 1 次提交
  12. 01 5月, 2014 1 次提交
  13. 11 4月, 2014 1 次提交
    • Y
      docs, make association `autosave: true` examples runnable. Closes #14700 · 856ffbe7
      Yves Senn 提交于
      [ci skip]
      
      The examples are written in a way you expect them to be executable.
      However one snippet assumed there to be two comments when only one
      was created above.
      
      The defined models did not extend `ActiveRecord::Base`
      
      The example used `comments.last.mark_for_destruction`. This does no
      longer load the whole collection but just the last record. It is
      then refetcht on subsequent calls to `last`. This breaks the example.
      856ffbe7
  14. 26 3月, 2014 1 次提交
  15. 21 2月, 2014 1 次提交
  16. 09 2月, 2014 1 次提交
  17. 01 11月, 2013 1 次提交
  18. 25 10月, 2013 1 次提交
  19. 17 10月, 2013 2 次提交
  20. 23 7月, 2013 2 次提交
  21. 16 7月, 2013 1 次提交
  22. 03 6月, 2013 1 次提交
  23. 02 5月, 2013 1 次提交
    • J
      destroys association records before saving/inserting new association records · 483c301e
      Johnny Holton 提交于
      fixes bug introduced by  #3329
      These are the conditions necessary to reproduce the bug:
      - For an association, autosave => true.
      - An association record is being destroyed
      - A new association record is being created.
      - There is a unique index one of the association's fields.
      - The record being created has the same value as the record being
      destroyed on the indexed field.
      
      Before, the deletion of records was postponed until after all
      insertions/saves.  Therefore the new record with the identical value in
      the indexed field caused a non-unique value error to be thrown at the database
      level.
      
      With this fix, the deletions happen first, before the insertions/saves.
      Therefore the record with the duplicate value is gone from the database
      before the new record is created, thereby avoiding the non-uniuqe value
      error.
      483c301e
  24. 19 4月, 2013 2 次提交
    • J
      Revert "Merge pull request #10183 from jholton/fix_association_auto_save" · 0920d4fc
      Jon Leighton 提交于
      This reverts commit e8727d37, reversing
      changes made to d098e1c2.
      
      Reason: it broke the mysql build
      0920d4fc
    • J
      destroys association records before saving/inserting new association records · 9de28419
      Johnny Holton 提交于
      fixes bug introduced by  #3329
      These are the conditions necessary to reproduce the bug:
      - For an association, autosave => true.
      - An association record is being destroyed
      - A new association record is being created.
      - There is a unique index one of the association's fields.
      - The record being created has the same value as the record being
      destroyed on the indexed field.
      
      Before, the deletion of records was postponed until after all
      insertions/saves.  Therefore the new record with the identical value in
      the indexed field caused a non-unique value error to be thrown at the database
      level.
      
      With this fix, the deletions happen first, before the insertions/saves.
      Therefore the record with the duplicate value is gone from the database
      before the new record is created, thereby avoiding the non-uniuqe value
      error.
      9de28419
  25. 17 4月, 2013 1 次提交
  26. 03 4月, 2013 1 次提交
  27. 21 3月, 2013 1 次提交
  28. 26 2月, 2013 1 次提交
  29. 18 1月, 2013 2 次提交
  30. 02 12月, 2012 1 次提交
  31. 09 11月, 2012 1 次提交
  32. 14 7月, 2012 1 次提交
  33. 12 5月, 2012 1 次提交
    • J
      CollectionProxy < Relation · c86a32d7
      Jon Leighton 提交于
      This helps bring the interfaces of CollectionProxy and Relation closer
      together, and reduces the delegation backflips we need to perform.
      
      For example, first_or_create is defined thus:
      
      class ActiveRecord::Relation
        def first_or_create(...)
          first || create(...)
        end
      end
      
      If CollectionProxy < Relation, then post.comments.first_or_create will
      hit the association's #create method which will actually add the new record
      to the association, just as post.comments.create would.
      
      With the previous delegation, post.comments.first_or_create expands to
      post.comments.scoped.first_or_create, where post.comments.scoped has no
      knowledge of the association.
      c86a32d7
  34. 18 3月, 2012 1 次提交
  35. 17 3月, 2012 1 次提交
  36. 14 3月, 2012 1 次提交