1. 02 7月, 2017 6 次提交
    • Y
      06b1e5f5
    • E
      Apply record state based on parent transaction state · 0237da28
      eileencodes 提交于
      Let's say you have a nested transaction and both records are saved.
      Before the outer transaction closes, a rollback is performed. Previously
      the record in the outer transaction would get marked as not persisted
      but the inner transaction would get persisted.
      
      ```ruby
      Post.transaction do
        post_one.save # will get rolled back
      
        Post.transaction(requires_new: true) do
          post_two.save # incorrectly remains marked as persisted
        end
      
        raise ActiveRecord::Rollback
      end
      ```
      
      To fix this the PR changes transaction handling to have the child
      transaction ask the parent how the records should be marked. When
      there are child transactions, it will always be a SavpointTransaction
      because the stack isn't empty. From there we pass the parent_transaction
      to the child SavepointTransaction where we add the children to the parent
      so the parent can mark the inner transaction as rolledback and thus mark
      the record as not persisted.
      
      `update_attributes_from_transaction_state` uses the `completed?` check to
      correctly mark all the transactions as rolledback and the inner record as
      not persisted.
      
      ```ruby
      Post.transaction do
        post_one.save # will get rolled back
      
        Post.transaction(requires_new: true) do
          post_two.save # with new behavior, correctly marked as not persisted
          on rollback
        end
      
        raise ActiveRecord::Rollback
      end
      ```
      
      Fixes #29320
      0237da28
    • E
      Deprecate and replace `set_state` method · 608ebccf
      eileencodes 提交于
      `set_state` was directly setting the transaction state instance
      variable. It's better to set the state via specific methods (`rollback!`
      and `commit!` respectively.
      
      While undocumented and untested, it's possible someone is using
      `set_state` in their app or gem so I've added a deprecation notice to
      it.
      
      No where in the app do we use `nullify!` but I wanted to keep existing
      behavior while replacing the method with a better pattern.
      608ebccf
    • E
      Merge pull request #29622 from yalab/warning_system_tesing_http_verb · c197418b
      Eileen M. Uchitelle 提交于
      Warning http verb method call in SystemTestCase
      c197418b
    • M
      Avoid shadowed variable · 310918f6
      Matthew Draper 提交于
      310918f6
    • M
      Revert "Merge pull request #29540 from kirs/rubocop-frozen-string" · 87b3e226
      Matthew Draper 提交于
      This reverts commit 3420a145, reversing
      changes made to afb66a5a.
      87b3e226
  2. 01 7月, 2017 21 次提交
  3. 30 6月, 2017 9 次提交
  4. 29 6月, 2017 4 次提交