1. 04 10月, 2019 1 次提交
  2. 07 6月, 2019 1 次提交
  3. 28 5月, 2019 1 次提交
  4. 13 5月, 2019 1 次提交
  5. 12 4月, 2019 1 次提交
  6. 20 2月, 2019 1 次提交
    • B
      Fix reset of the source association when through association is loaded · bd4eff2f
      Bogdan Gusiev 提交于
      The special case happens when through association has a custom scope
      that is applied to the source association when loading.
      In this case, the soucre association would need to be reset after
      main association is loaded. See tests.
      
      The special case exists when a through association has
      bd4eff2f
  7. 13 2月, 2019 1 次提交
  8. 08 2月, 2019 1 次提交
  9. 06 2月, 2019 1 次提交
  10. 05 2月, 2019 1 次提交
  11. 18 1月, 2019 1 次提交
    • R
      Ensure `StatementCache#execute` never raises `RangeError` · c196ca72
      Ryuta Kamizono 提交于
      Since 31ffbf8d, finder methods no longer raise `RangeError`. So
      `StatementCache#execute` is the only place to raise the exception for
      finder queries.
      
      `StatementCache` is used for simple equality queries in the codebase.
      This means that if `StatementCache#execute` raises `RangeError`, the
      result could always be regarded as empty.
      So `StatementCache#execute` just return nil in that range error case,
      and treat that as empty in the caller side, then we can avoid catching
      the exception in much places.
      c196ca72
  12. 15 1月, 2019 1 次提交
  13. 04 12月, 2018 2 次提交
  14. 26 11月, 2018 1 次提交
  15. 10 10月, 2018 1 次提交
  16. 09 10月, 2018 2 次提交
    • R
      Generate delegation methods to named scope in the definition time · 136b738c
      Ryuta Kamizono 提交于
      The delegation methods to named scope are defined when `method_missing`
      is invoked on the relation.
      
      Since #29301, the receiver in the named scope is changed to the relation
      like others (e.g. `default_scope`, etc) for consistency.
      
      Most named scopes would be delegated from relation by `method_missing`,
      since we don't allow scopes to be defined which conflict with instance
      methods on `Relation` (#31179). But if a named scope is defined with the
      same name as any method on the `superclass` (e.g. `Kernel.open`), the
      `method_missing` on the relation is not invoked.
      
      To address the issue, make the delegation methods to named scope is
      generated in the definition time.
      
      Fixes #34098.
      136b738c
    • R
      Call `define_attribute_methods` before `assert_no_queries` to address CI flakiness · a1ee4a9f
      Ryuta Kamizono 提交于
      Follow up 45be690f.
      
      Somehow calling `define_attribute_methods` in `build`/`new` sometimes
      causes the `table_exists?` query.
      
      To address CI flakiness due to `assert_no_queries` failure, ensure
      `define_attribute_methods` before `assert_no_queries`.
      a1ee4a9f
  17. 07 10月, 2018 2 次提交
    • R
      Fix test name to add missing "set" · 2b5b08b8
      Ryuta Kamizono 提交于
      2b5b08b8
    • R
      Fix `AssociationRelation` not to set inverse instance key just like before · 1f8534ca
      Ryuta Kamizono 提交于
      Since #31575, `set_inverse_instance` replaces the foreign key by the
      current owner immediately to make it happen when a record is added to
      collection association.
      
      But `set_inverse_instance` is not only called when a record is added,
      but also when a record is loaded from queries. And also, that loaded
      records are not always associated records for some reason (using `or`,
      `unscope`, `rewhere`, etc).
      
      It is hard to distinguish whether or not we should invoke
      `set_inverse_instance`, but at least we should avoid the undesired
      side-effect which was brought from #31575.
      
      Fixes #34108.
      1f8534ca
  18. 05 10月, 2018 2 次提交
  19. 26 9月, 2018 2 次提交
  20. 25 8月, 2018 2 次提交
  21. 13 8月, 2018 1 次提交
    • U
      Add method_call_assertions and use them instead of Mocha · a72bca82
      utilum 提交于
      Six Mocha calls prove quite resistant to Minitestification. For example,
      if we replace
      
      ```
        ActiveRecord::Associations::HasManyAssociation
          .any_instance
          .expects(:reader)
          .never
      ```
      
      with `assert_not_called`, Minitest wisely raises
      
      ```
      NameError: undefined method `reader' for class `ActiveRecord::Associations::HasManyAssociation'
      ```
      
      as `:reader` comes from a deeply embedded abstract class,
      `ActiveRecord::Associations::CollectionAssociation`.
      
      This patch tackles this difficulty by adding
      `ActiveSupport::Testing::MethodCallAsserts#assert_called_on_instance_of`
      which injects a stubbed method into `klass`, and verifies the number of
      times it is called, similar to `assert_called`. It also adds  a convenience
      method, `assert_not_called_on_instance_of`, mirroring
      `assert_not_called`.
      
      It uses the new method_call_assertions to replace the remaining Mocha
      calls in `ActiveRecord` tests.
      
      [utilum + bogdanvlviv + kspath]
      a72bca82
  22. 07 6月, 2018 1 次提交
    • R
      Fix `collection.create` to could be rolled back by `after_save` · 5dc72378
      Ryuta Kamizono 提交于
      In `_create_record`, explicit `transaction` block requires rollback
      handling manually when `insert_record` is failed.
      
      We need to handle it in `_create_record`, not in `insert_record`, since
      our test cases expect a record added to target and returned even if
      `insert_record` is failed,
      
      Closes #31488.
      5dc72378
  23. 13 5月, 2018 1 次提交
  24. 27 4月, 2018 2 次提交
  25. 26 4月, 2018 2 次提交
  26. 21 4月, 2018 1 次提交
  27. 19 4月, 2018 1 次提交
  28. 30 3月, 2018 1 次提交
  29. 18 2月, 2018 2 次提交
  30. 26 1月, 2018 2 次提交