| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | |/
| | |
| | |
| | |
| | |
| | |
| | | |
When a has_many association is destroyed by `dependent: destroy`,
destroyed_by_association is set to the reflection, and this can be
checked in callbacks. This matches that behaviour for has_one
associations.
|
| | |
| | |
| | |
| | |
| | | |
This fixes the following failures.
https://travis-ci.org/rails/rails/jobs/253990014
|
| |/ |
|
| |\
| | |
| | | |
Add a test case for overwriting existing condition on associations
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Overwriting existing condition on associations has already supported
(23bcc65 for eager loading, 2bfa2c0 for preloading).
Fixes #27724.
Closes #29154.
|
| |/
| |
| |
| |
| | |
Since 07e5301, `Relation#first` will order by primary key if no order is
defined.
|
| |
| |
| |
| |
| | |
This fixes the following failures.
https://travis-ci.org/rails/rails/jobs/253990014
|
|\| |
|
| |
| |
| |
| | |
Fixes #28324.
|
| | |
|
| |
| |
| |
| | |
It is covered by following assertion.
|
| |
| |
| |
| |
| | |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |\
| | |
| | |
| | | |
Enforce frozen string in Rubocop
|
| | | |
|
| |\ \
| | | |
| | | | |
Should be clear `@association_ids` when joined newly associated record
|
| | |/
| | |
| | |
| | | |
Fixes #29627.
|
| |\ \
| | |/
| |/| |
Fix automatic inverse for polymorphic interfaces
|
| | |
| | |
| | |
| | | |
relationships when building objects on new records
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This makes automatic inverse detection possible for polymorphic
:has_one & :has_many possible.
This resolves a number of issues, eg. `touch: true` on polymorphic relationships (#16446) and automatically setting inverse associations on newly built objects (#15028, #21843).
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
`aliased_table_name` in `Association` was added at a3502c4.
`aliased_table_name` in `JoinDependency` (added at 55854c4) is used, but
it looks like that added one in `Association` is never used from the
beginning.
|
| |\ \
| | | |
| | | |
| | | |
| | | |
| | | | |
kamipo/fix_eager_loading_to_respect_store_full_sti_class
Fix eager loading to respect `store_full_sti_class` setting
|
| | | | |
|
| |\ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
kamipo/dont_passing_klass_connection_to_association_scope
Don't passing `klass.connection` to `AssociationScope`
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Passing `klass.connection` is redundant because `AssociationScope` is
passed an association itself and an association has `klass`.
|
| |\ \ \ \
| | |_|/ /
| |/| | | |
Add a test case for unscoping `default_scope` in associations
|
| | |/ /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Unscoping `default_scope` in associations has already supported (#17360
for preloading, c9cf8b8 for eager loading).
Fixes #20679.
Closes #16531.
|
| |\ \ \
| | |/ /
| |/| | |
Use `reload` in `test_find_first_after_reload`
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
And use `assert_same` instead of `assert_equal` and tiny fix assert
message s/#reload/#reset/.
Follow up of #29511.
|
| |/ /
| | |
| | |
| | |
| | | |
If a record was built on a HasManyThroughAssociation, then removed, and
then the record was saved, the removed record would be created anyways.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The `@offsets` cache is used by FinderMethods to cache records found by
find_nth. This cache is cleared in AR::Relation#reset, but not in
CollectionProxy#reset or CollectionProxy#reload.
Because of this, since #29098, calling #first/#find_nth/etc after
calling #reload or #reset on an association could return a stale record.
This is an issue both when the full association target is loaded and
when the item is loaded in #find_nth.
This commit solves the problem by clearing the `@offsets` cache in
CollectionProxy#reset and CollectionProxy#reload.
|
| | |
| | |
| | |
| | |
| | |
| | | |
A collection association will raise on `#create_association` when the parent is
unpersisted. A singular association should do the same. This addresses
issue #29219.
|
| | |
| | |
| | |
| | | |
These `assert_nothing_raised` are covered by following assertions.
|
|\| | |
|
| | | |
|
| | | |
|
| |\ \
| | | |
| | | |
| | | | |
Fix association with extension issues
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This fixes the following issues.
* `association_scope` doesn't include `default_scope`. Should use `scope` instead.
* We can't use `method_missing` for customizing existing method.
* We can't use `relation_delegate_class` for sharing extensions. Should extend per association.
|
|\| | | |
|
| |/ / |
|
| |\ \
| | | |
| | | | |
Define path with __dir__
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
".. with __dir__ we can restore order in the Universe." - by @fxn
Related to 5b8738c2df003a96f0e490c43559747618d10f5f
|
| | | | |
|
| |\ \ \
| | | | |
| | | | | |
Make helper methods in tests to private
|
| | |/ /
| | | |
| | | |
| | | |
| | | | |
`make_model` and `make_no_pk_hm_t` in `HasManyThroughAssociationsTest`
are not a test case. it should be private.
|
| |/ / |
|
| | |
| | |
| | |
| | | |
Fixes #29025.
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
This change reverted in eac6f369 but it is needed for data integrity.
See #25328.
|
|/ /
| |
| |
| |
| |
| |
| |
| | |
- Tried specifying `id` for the `readers` records but it is
interconnected with so many tests that many random tests started
failing.
- So switched to the approach of deleting all readers in the
`create_resets_cached_counters` test.
|